mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-25 23:47:53 +00:00
env_parallel: --env _ supported in (t)csh and pdksh.
This commit is contained in:
parent
3ba7a4646d
commit
68a48146ea
|
@ -33,7 +33,8 @@ env_parallel() {
|
|||
# and convert a b c to (a|b|c)
|
||||
# If --env not set: Match everything (.*)
|
||||
local _grep_REGEXP="$(
|
||||
perl -e 'for(@ARGV){
|
||||
perl -e '
|
||||
for(@ARGV){
|
||||
/^_$/ and $next_is_env = 0;
|
||||
$next_is_env and push @envvar, split/,/, $_;
|
||||
$next_is_env = /^--env$/;
|
||||
|
@ -44,18 +45,27 @@ env_parallel() {
|
|||
)"
|
||||
# Deal with --env _
|
||||
local _ignore_UNDERSCORE="$(
|
||||
perl -e 'for(@ARGV){
|
||||
perl -e '
|
||||
for(@ARGV){
|
||||
$next_is_env and push @envvar, split/,/, $_;
|
||||
$next_is_env=/^--env$/;
|
||||
}
|
||||
$underscore = grep { /^_$/ } @envvar;
|
||||
print $underscore ? "grep -vf $ENV{HOME}/.parallel/ignored_vars" : "cat";
|
||||
if(grep { /^_$/ } @envvar) {
|
||||
if(not open(IN, "<", "$ENV{HOME}/.parallel/ignored_vars")) {
|
||||
print STDERR "parallel: Error: ",
|
||||
"Run \"parallel --record-env\" in a clean environment first.\n";
|
||||
} else {
|
||||
chomp(@ignored_vars = <IN>);
|
||||
$vars = join "|",map { quotemeta $_ } @ignored_vars;
|
||||
print $vars ? "($vars)" : "(,,nO,,VaRs,,)";
|
||||
}
|
||||
}
|
||||
' -- "$@"
|
||||
)"
|
||||
|
||||
# Grep alias names
|
||||
local _alias_NAMES="$(compgen -a |
|
||||
egrep "^${_grep_REGEXP}\$" | $_ignore_UNDERSCORE)"
|
||||
grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$ )"
|
||||
local _list_alias_BODIES="alias $_alias_NAMES"
|
||||
if [[ "$_alias_NAMES" = "" ]] ; then
|
||||
# no aliases selected
|
||||
|
@ -65,7 +75,7 @@ env_parallel() {
|
|||
|
||||
# Grep function names
|
||||
local _function_NAMES="$(compgen -A function |
|
||||
egrep "^${_grep_REGEXP}\$" | $_ignore_UNDERSCORE)"
|
||||
grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$ )"
|
||||
local _list_function_BODIES="typeset -f $_function_NAMES"
|
||||
if [[ "$_function_NAMES" = "" ]] ; then
|
||||
# no functions selected
|
||||
|
@ -75,7 +85,7 @@ env_parallel() {
|
|||
|
||||
# Grep variable names
|
||||
local _variable_NAMES="$(compgen -A variable |
|
||||
egrep "^${_grep_REGEXP}\$" | $_ignore_UNDERSCORE |
|
||||
grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$ |
|
||||
grep -vFf <(readonly) |
|
||||
egrep -v '^(BASHOPTS|BASHPID|EUID|GROUPS|FUNCNAME|DIRSTACK|_|PIPESTATUS|PPID|SHELLOPTS|UID|USERNAME|BASH_[A-Z_]+)$')"
|
||||
local _list_variable_VALUES="typeset -p $_variable_NAMES"
|
||||
|
@ -101,17 +111,3 @@ env_parallel() {
|
|||
`which parallel` "$@";
|
||||
unset PARALLEL_ENV;
|
||||
}
|
||||
|
||||
# Supports env of 127375 bytes
|
||||
#
|
||||
# _env_parallel() {
|
||||
# # Saving to a tempfile
|
||||
# export PARALLEL_ENV=`tempfile`;
|
||||
# (echo "shopt -s expand_aliases 2>/dev/null"; alias;typeset -p |
|
||||
# grep -vFf <(readonly) |
|
||||
# grep -v 'declare .. (GROUPS|FUNCNAME|DIRSTACK|_|PIPESTATUS|USERNAME|BASH_[A-Z_]+) ';
|
||||
# typeset -f) > $PARALLEL_ENV
|
||||
# `which parallel` "$@";
|
||||
# rm "$PARALLEL_ENV"
|
||||
# unset PARALLEL_ENV;
|
||||
# }
|
||||
|
|
|
@ -29,8 +29,48 @@ if ("`alias env_parallel`" == '') then
|
|||
# Activate alias
|
||||
alias env_parallel 'setenv PARALLEL "\!*"; source `which env_parallel.csh`'
|
||||
else
|
||||
# Get the --env variables if set
|
||||
# --env _ should be ignored
|
||||
# and convert a b c to (a|b|c)
|
||||
# If --env not set: Match everything (.*)
|
||||
set _tMpscRIpt=`tempfile`
|
||||
cat <<'EOF' > $_tMpscRIpt
|
||||
#!/usr/bin/perl
|
||||
|
||||
for(@ARGV){
|
||||
/^_$/ and $next_is_env = 0;
|
||||
$next_is_env and push @envvar, split/,/, $_;
|
||||
$next_is_env = /^--env$/;
|
||||
}
|
||||
$vars = join "|",map { quotemeta $_ } @envvar;
|
||||
print $vars ? "($vars)" : "(.*)";
|
||||
'EOF'
|
||||
set _grep_REGEXP="`perl $_tMpscRIpt -- $PARALLEL`"
|
||||
|
||||
# Deal with --env _
|
||||
cat <<'EOF' > $_tMpscRIpt
|
||||
#!/usr/bin/perl
|
||||
|
||||
for(@ARGV){
|
||||
$next_is_env and push @envvar, split/,/, $_;
|
||||
$next_is_env=/^--env$/;
|
||||
}
|
||||
if(grep { /^_$/ } @envvar) {
|
||||
if(not open(IN, "<", "$ENV{HOME}/.parallel/ignored_vars")) {
|
||||
print STDERR "parallel: Error: ",
|
||||
"Run 'parallel --record-env' in a clean environment first.\n";
|
||||
} else {
|
||||
chomp(@ignored_vars = <IN>);
|
||||
$vars = join "|",map { quotemeta $_ } @ignored_vars;
|
||||
print $vars ? "($vars)" : "(,,nO,,VaRs,,)";
|
||||
}
|
||||
}
|
||||
'EOF'
|
||||
set _ignore_UNDERSCORE="`perl $_tMpscRIpt -- $PARALLEL`"
|
||||
rm $_tMpscRIpt
|
||||
|
||||
# Get the scalar and array variable names
|
||||
set _vARnAmES=(`set | awk -e '{print $1}' |grep -v prompt2`)
|
||||
set _vARnAmES=(`set | awk -e '{print $1}' |grep -vE '^(#|_|killring|prompt2|command)$' | grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$`)
|
||||
|
||||
# Make a tmpfile for the variable definitions
|
||||
set _tMpvARfILe=`tempfile`
|
||||
|
@ -38,19 +78,20 @@ else
|
|||
# Make a tmpfile for the variable definitions + alias
|
||||
set _tMpaLLfILe=`tempfile`
|
||||
foreach _vARnAmE ($_vARnAmES);
|
||||
# if $?myvar && $#myvar <= 1 echo scalar_myvar=$var
|
||||
eval if'($?'$_vARnAmE' && ${#'$_vARnAmE'} <= 1) echo scalar_'$_vARnAmE'="$'$_vARnAmE'"' >> $_tMpvARfILe;
|
||||
# if $?myvar && $#myvar > 1 echo array_myvar=$var
|
||||
eval if'($?'$_vARnAmE' && ${#'$_vARnAmE'} > 1) echo array_'$_vARnAmE'="$'$_vARnAmE'"' >> $_tMpvARfILe;
|
||||
# if not defined: next
|
||||
eval if'(! $?'$_vARnAmE') continue'
|
||||
# if $#myvar <= 1 echo scalar_myvar=$var
|
||||
eval if'(${#'$_vARnAmE'} <= 1) echo scalar_'$_vARnAmE'='\"\$$_vARnAmE\" >> $_tMpvARfILe;
|
||||
# if $#myvar > 1 echo array_myvar=$var
|
||||
eval if'(${#'$_vARnAmE'} > 1) echo array_'$_vARnAmE'="$'$_vARnAmE'"' >> $_tMpvARfILe;
|
||||
end
|
||||
|
||||
unset _vARnAmE _vARnAmES
|
||||
# shell quote variables (--plain needed due to $PARALLEL abuse)
|
||||
# Convert 'scalar_myvar=...' to 'set myvar=...'
|
||||
# Convert 'array_myvar=...' to 'set array=(...)'
|
||||
cat $_tMpvARfILe | parallel --plain --shellquote | perl -pe 's/^scalar_(\S+).=/set $1=/ or s/^array_(\S+).=(.*)/set $1=($2)/ && s/\\ / /g;' > $_tMpaLLfILe
|
||||
|
||||
# Cleanup
|
||||
rm $_tMpvARfILe; unset _tMpvARfILe _vARnAmE _vARnAmES
|
||||
rm $_tMpvARfILe; unset _tMpvARfILe
|
||||
|
||||
# ALIAS TO EXPORT ALIASES:
|
||||
|
||||
|
@ -61,8 +102,6 @@ else
|
|||
# Quoted: s/\\047/\\047\\042\\047\\042\\047/g\;
|
||||
|
||||
# Remove () from second column
|
||||
# s/^(\S+)(\s+)\((.*)\)/\1\2\3/
|
||||
# \047 => '
|
||||
# s/^(\S+)(\s+)\((.*)\)/\1\2\3/;
|
||||
# Quoted: s/\^\(\\S+\)\(\\s+\)\\\(\(.\*\)\\\)/\\1\\2\\3/\;
|
||||
|
||||
|
@ -79,7 +118,10 @@ else
|
|||
# Prepend with "\nalias "
|
||||
# s/^/\001alias /;
|
||||
# Quoted: s/\^/\\001alias\ /\;
|
||||
alias | perl -pe s/\\047/\\047\\042\\047\\042\\047/g\;s/\^\(\\S+\)\(\\s+\)\\\(\(.\*\)\\\)/\\1\\2\\3/\;s/\^\(\\S+\)\(\\s+\)\(.\*\)/\\1\\2\\047\\3\\047/\;s/\^/\\001alias\ /\;s/\\\!/\\\\\\\!/g >> $_tMpaLLfILe
|
||||
alias | \
|
||||
grep -E "^$_grep_REGEXP" | \
|
||||
grep -vE "^$_ignore_UNDERSCORE""[^_a-zA-Z]" | \
|
||||
perl -pe s/\\047/\\047\\042\\047\\042\\047/g\;s/\^\(\\S+\)\(\\s+\)\\\(\(.\*\)\\\)/\\1\\2\\3/\;s/\^\(\\S+\)\(\\s+\)\(.\*\)/\\1\\2\\047\\3\\047/\;s/\^/\\001alias\ /\;s/\\\!/\\\\\\\!/g >> $_tMpaLLfILe
|
||||
|
||||
setenv PARALLEL_ENV "`cat $_tMpaLLfILe; rm $_tMpaLLfILe`";
|
||||
unset _tMpaLLfILe;
|
||||
|
|
|
@ -44,10 +44,44 @@ function env_parallel
|
|||
# env_parallel.fish
|
||||
setenv PARALLEL_ENV (
|
||||
begin;
|
||||
set _grep_REGEXP (
|
||||
begin;
|
||||
perl -e 'for(@ARGV){
|
||||
/^_$/ and $next_is_env = 0;
|
||||
$next_is_env and push @envvar, split/,/, $_;
|
||||
$next_is_env = /^--env$/;
|
||||
}
|
||||
$vars = join "|",map { quotemeta $_ } @envvar;
|
||||
print $vars ? "($vars)" : "(.*)";
|
||||
' -- $argv;
|
||||
end;
|
||||
)
|
||||
# Deal with --env _
|
||||
set _ignore_UNDERSCORE (
|
||||
begin;
|
||||
perl -e '
|
||||
for(@ARGV){
|
||||
$next_is_env and push @envvar, split/,/, $_;
|
||||
$next_is_env=/^--env$/;
|
||||
}
|
||||
if(grep { /^_$/ } @envvar) {
|
||||
if(not open(IN, "<", "$ENV{HOME}/.parallel/ignored_vars")) {
|
||||
print STDERR "parallel: Error: ",
|
||||
"Run \"parallel --record-env\" in a clean environment first.\n";
|
||||
} else {
|
||||
chomp(@ignored_vars = <IN>);
|
||||
$vars = join "|",map { quotemeta $_ } @ignored_vars;
|
||||
print $vars ? "($vars)" : "(nO,VaRs)";
|
||||
}
|
||||
}
|
||||
' -- $argv;
|
||||
end;
|
||||
)
|
||||
|
||||
# Export function definitions
|
||||
functions -n | perl -pe 's/,/\n/g' | while read d; functions $d; end;
|
||||
functions -n | perl -pe 's/,/\n/g' | grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$ | while read d; functions $d; end;
|
||||
# Convert scalar vars to fish \XX quoting
|
||||
eval (set -L | perl -ne 'chomp;
|
||||
eval (set -L | grep -E "^$_grep_REGEXP " | grep -vE "^$_ignore_UNDERSCORE " | perl -ne 'chomp;
|
||||
($name,$val)=split(/ /,$_,2);
|
||||
$name=~/^(HOME|USER|COLUMNS|FISH_VERSION|LINES|PWD|SHLVL|_|history|status|version)$/ and next;
|
||||
if($val=~/^'"'"'/) { next; }
|
||||
|
@ -55,7 +89,7 @@ function env_parallel
|
|||
')
|
||||
# Generate commands to set scalar variables
|
||||
begin;
|
||||
for v in (set -n);
|
||||
for v in (set -n | grep -E "^$_grep_REGEXP\$" | grep -vE "^$_ignore_UNDERSCORE\$");
|
||||
# Separate variables with the string: \000
|
||||
eval "for i in \$$v;
|
||||
echo -n $v \$i;
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
# or write to the Free Software Foundation, Inc., 51 Franklin St,
|
||||
# Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# Supports env of 127426 bytes
|
||||
|
||||
env_parallel() {
|
||||
# env_parallel.ksh
|
||||
|
||||
|
@ -35,10 +33,11 @@ env_parallel() {
|
|||
# and convert a b c to (a|b|c)
|
||||
# If --env not set: Match everything (.*)
|
||||
_grep_REGEXP="$(
|
||||
perl -e 'for(@ARGV){
|
||||
perl -e '
|
||||
for(@ARGV){
|
||||
/^_$/ and $next_is_env = 0;
|
||||
$next_is_env and push @envvar, split/,/, $_;
|
||||
$next_is_env=/^--env$/;
|
||||
$next_is_env = /^--env$/;
|
||||
}
|
||||
$vars = join "|",map { quotemeta $_ } @envvar;
|
||||
print $vars ? "($vars)" : "(.*)";
|
||||
|
@ -46,18 +45,27 @@ env_parallel() {
|
|||
)"
|
||||
# Deal with --env _
|
||||
_ignore_UNDERSCORE="$(
|
||||
perl -e 'for(@ARGV){
|
||||
perl -e '
|
||||
for(@ARGV){
|
||||
$next_is_env and push @envvar, split/,/, $_;
|
||||
$next_is_env=/^--env$/;
|
||||
}
|
||||
$underscore = grep { /^_$/ } @envvar;
|
||||
print $underscore ? "grep -vf $ENV{HOME}/.parallel/ignored_vars" : "cat";
|
||||
if(grep { /^_$/ } @envvar) {
|
||||
if(not open(IN, "<", "$ENV{HOME}/.parallel/ignored_vars")) {
|
||||
print STDERR "parallel: Error: ",
|
||||
"Run \"parallel --record-env\" in a clean environment first.\n";
|
||||
} else {
|
||||
chomp(@ignored_vars = <IN>);
|
||||
$vars = join "|",map { quotemeta $_ } @ignored_vars;
|
||||
print $vars ? "($vars)" : "(,,nO,,VaRs,,)";
|
||||
}
|
||||
}
|
||||
' -- "$@"
|
||||
)"
|
||||
|
||||
# Grep alias names
|
||||
_alias_NAMES="$(alias | perl -pe 's/=.*//' |
|
||||
egrep "^${_grep_REGEXP}\$" | $_ignore_UNDERSCORE)"
|
||||
grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$ )"
|
||||
_list_alias_BODIES="alias $_alias_NAMES | perl -pe 's/^/alias /'"
|
||||
if [[ "$_alias_NAMES" = "" ]] ; then
|
||||
# no aliases selected
|
||||
|
@ -67,7 +75,7 @@ env_parallel() {
|
|||
|
||||
# Grep function names
|
||||
_function_NAMES="$(typeset +p -f | perl -pe 's/\(\).*//' |
|
||||
egrep "^${_grep_REGEXP}\$" | $_ignore_UNDERSCORE)"
|
||||
grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$ )"
|
||||
_list_function_BODIES="typeset -f $_function_NAMES"
|
||||
if [[ "$_function_NAMES" = "" ]] ; then
|
||||
# no functions selected
|
||||
|
@ -77,7 +85,7 @@ env_parallel() {
|
|||
|
||||
# Grep variable names
|
||||
_variable_NAMES="$(typeset +p | perl -pe 's/^typeset .. //' |
|
||||
egrep "^${_grep_REGEXP}\$" | $_ignore_UNDERSCORE |
|
||||
grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$ |
|
||||
egrep -v '^(PIPESTATUS)$')"
|
||||
_list_variable_VALUES="typeset -p $_variable_NAMES"
|
||||
if [[ "$_variable_NAMES" = "" ]] ; then
|
||||
|
@ -97,10 +105,3 @@ env_parallel() {
|
|||
`which parallel` "$@";
|
||||
unset PARALLEL_ENV;
|
||||
}
|
||||
|
||||
# _env_parallel() {
|
||||
# # env_parallel.ksh
|
||||
# export PARALLEL_ENV="$(alias | perl -pe 's/^/alias /';typeset -p|egrep -v 'typeset( -i)? -r|PIPESTATUS';typeset -f)";
|
||||
# `which parallel` "$@";
|
||||
# unset PARALLEL_ENV;
|
||||
# }
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/pdksh
|
||||
|
||||
# This file must be sourced in ksh:
|
||||
# This file must be sourced in pdksh:
|
||||
#
|
||||
# source `which env_parallel.ksh`
|
||||
# source `which env_parallel.pdksh`
|
||||
#
|
||||
# after which 'env_parallel' works
|
||||
#
|
||||
|
@ -26,8 +26,87 @@
|
|||
# Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
env_parallel() {
|
||||
# env_parallel.pdksh
|
||||
export PARALLEL_ENV="$(alias | perl -pe 's/^/alias /';typeset -p|egrep -v 'typeset( -i)? -r|PIPESTATUS';typeset -f)";
|
||||
`which parallel` "$@";
|
||||
unset PARALLEL_ENV;
|
||||
# env_parallel.pdksh
|
||||
|
||||
# Get the --env variables if set
|
||||
# --env _ should be ignored
|
||||
# and convert a b c to (a|b|c)
|
||||
# If --env not set: Match everything (.*)
|
||||
_grep_REGEXP="$(
|
||||
perl -e '
|
||||
for(@ARGV){
|
||||
/^_$/ and $next_is_env = 0;
|
||||
$next_is_env and push @envvar, split/,/, $_;
|
||||
$next_is_env = /^--env$/;
|
||||
}
|
||||
$vars = join "|",map { quotemeta $_ } @envvar;
|
||||
print $vars ? "($vars)" : "(.*)";
|
||||
' -- "$@"
|
||||
)"
|
||||
# Deal with --env _
|
||||
_ignore_UNDERSCORE="$(
|
||||
perl -e '
|
||||
for(@ARGV){
|
||||
$next_is_env and push @envvar, split/,/, $_;
|
||||
$next_is_env=/^--env$/;
|
||||
}
|
||||
if(grep { /^_$/ } @envvar) {
|
||||
if(not open(IN, "<", "$ENV{HOME}/.parallel/ignored_vars")) {
|
||||
print STDERR "parallel: Error: ",
|
||||
"Run \"parallel --record-env\" in a clean environment first.\n";
|
||||
} else {
|
||||
chomp(@ignored_vars = <IN>);
|
||||
$vars = join "|",map { quotemeta $_ } @ignored_vars;
|
||||
print $vars ? "($vars)" : "(,,nO,,VaRs,,)";
|
||||
}
|
||||
}
|
||||
' -- "$@"
|
||||
)"
|
||||
|
||||
# Grep alias names
|
||||
_alias_NAMES="$(alias | perl -pe 's/=.*//' |
|
||||
grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$ )"
|
||||
_list_alias_BODIES="alias $_alias_NAMES | perl -pe 's/^/alias /'"
|
||||
if [[ "$_alias_NAMES" = "" ]] ; then
|
||||
# no aliases selected
|
||||
_list_alias_BODIES="true"
|
||||
fi
|
||||
unset _alias_NAMES
|
||||
|
||||
# Grep function names
|
||||
_function_NAMES=$(typeset +p -f | perl -pe 's/\(\).*//' |
|
||||
grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$ )
|
||||
_list_function_BODIES="typeset -f $_function_NAMES"
|
||||
if [[ "$_function_NAMES" = "" ]] ; then
|
||||
# no functions selected
|
||||
_list_function_BODIES="true"
|
||||
fi
|
||||
unset _function_NAMES
|
||||
|
||||
# Grep variable names
|
||||
_tmp_READONLY="$(mktemp)"
|
||||
readonly > "$_tmp_READONLY"
|
||||
_variable_NAMES="$(typeset | perl -pe 's/^(type)?set( -.)* //' |
|
||||
grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$ |
|
||||
grep -vFf $_tmp_READONLY |
|
||||
grep -Ev '^(PIPESTATUS)')"
|
||||
rm $_tmp_READONLY
|
||||
unset _tmp_READONLY
|
||||
_list_variable_VALUES="typeset -p $_variable_NAMES"
|
||||
if [[ "$_variable_NAMES" = "" ]] ; then
|
||||
# no variables selected
|
||||
_list_variable_VALUES="true"
|
||||
fi
|
||||
unset _variable_NAMES
|
||||
|
||||
# eval is needed for aliases - cannot explain why
|
||||
export PARALLEL_ENV="$(
|
||||
eval $_list_alias_BODIES;
|
||||
$_list_variable_VALUES;
|
||||
$_list_function_BODIES)";
|
||||
unset _list_alias_BODIES
|
||||
unset _list_variable_VALUES
|
||||
unset _list_function_BODIES
|
||||
`which parallel` "$@";
|
||||
unset PARALLEL_ENV;
|
||||
}
|
||||
|
|
|
@ -160,29 +160,37 @@ E.g. by doing:
|
|||
|
||||
=item aliases
|
||||
|
||||
alias myecho=echo
|
||||
env_parallel myecho ::: test
|
||||
env_parallel -S server myecho ::: test
|
||||
alias myecho 'echo aliases'
|
||||
env_parallel myecho ::: work
|
||||
env_parallel -S server myecho ::: work
|
||||
env_parallel --env myecho myecho ::: work
|
||||
env_parallel --env myecho -S server myecho ::: work
|
||||
|
||||
=item functions
|
||||
|
||||
function myfunc
|
||||
echo $argv
|
||||
echo functions $argv
|
||||
end
|
||||
env_parallel myfunc ::: test
|
||||
env_parallel -S server myfunc ::: test
|
||||
env_parallel myfunc ::: work
|
||||
env_parallel -S server myfunc ::: work
|
||||
env_parallel --env myfunc myfunc ::: work
|
||||
env_parallel --env myfunc -S server myfunc ::: work
|
||||
|
||||
=item variables
|
||||
|
||||
set myvar test
|
||||
env_parallel echo '$myvar' ::: test
|
||||
env_parallel -S server echo '$myvar' ::: test
|
||||
set myvar variables
|
||||
env_parallel echo '$myvar' ::: work
|
||||
env_parallel -S server echo '$myvar' ::: work
|
||||
env_parallel --env myvar echo '$myvar' ::: work
|
||||
env_parallel --env myvar -S server echo '$myvar' ::: work
|
||||
|
||||
=item arrays
|
||||
|
||||
set myarray foo bar baz
|
||||
env_parallel echo '$myarray[{}]' ::: 1 2 3
|
||||
env_parallel -S server echo '$myarray[{}]' ::: 1 2 3
|
||||
set myarray arrays work, too
|
||||
env_parallel -k echo '$myarray[{}]' ::: 1 2 3
|
||||
env_parallel -k -S server echo '$myarray[{}]' ::: 1 2 3
|
||||
env_parallel -k --env myarray echo '$myarray[{}]' ::: 1 2 3
|
||||
env_parallel -k --env myarray -S server echo '$myarray[{}]' ::: 1 2 3
|
||||
|
||||
=back
|
||||
|
||||
|
@ -250,27 +258,35 @@ E.g. by doing:
|
|||
|
||||
=item aliases
|
||||
|
||||
alias myecho=echo
|
||||
env_parallel myecho ::: test
|
||||
env_parallel -S server myecho ::: test
|
||||
alias myecho="echo aliases";
|
||||
env_parallel myecho ::: work;
|
||||
env_parallel -S server myecho ::: work;
|
||||
env_parallel --env myecho myecho ::: work;
|
||||
env_parallel --env myecho -S server myecho ::: work
|
||||
|
||||
=item functions
|
||||
|
||||
myfunc() { echo $*; }
|
||||
env_parallel myfunc ::: test
|
||||
env_parallel -S server myfunc ::: test
|
||||
myfunc() { echo functions $*; };
|
||||
env_parallel myfunc ::: work;
|
||||
env_parallel -S server myfunc ::: work;
|
||||
env_parallel --env myfunc myfunc ::: work;
|
||||
env_parallel --env myfunc -S server myfunc ::: work
|
||||
|
||||
=item variables
|
||||
|
||||
myvar=test
|
||||
env_parallel echo '$myvar' ::: test
|
||||
env_parallel -S server echo '$myvar' ::: test
|
||||
myvar=variables;
|
||||
env_parallel echo "\$myvar" ::: work;
|
||||
env_parallel -S server echo "\$myvar" ::: work;
|
||||
env_parallel --env myvar echo "\$myvar" ::: work;
|
||||
env_parallel --env myvar -S server echo "\$myvar" ::: work
|
||||
|
||||
=item arrays
|
||||
|
||||
myarray=(foo bar baz)
|
||||
env_parallel echo '${myarray[{}]}' ::: 0 1 2
|
||||
env_parallel -S server echo '${myarray[{}]}' ::: 0 1 2
|
||||
myarray=(arrays work, too);
|
||||
env_parallel -k echo "\${myarray[{}]}" ::: 0 1 2;
|
||||
env_parallel -k -S server echo "\${myarray[{}]}" ::: 0 1 2;
|
||||
env_parallel -k --env myarray echo "\${myarray[{}]}" ::: 0 1 2;
|
||||
env_parallel -k --env myarray -S server echo "\${myarray[{}]}" ::: 0 1 2
|
||||
|
||||
=back
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ else
|
|||
# If --env not set: Match everything (.*)
|
||||
set _tMpscRIpt=`tempfile`
|
||||
cat <<'EOF' > $_tMpscRIpt
|
||||
#!/usr/bin/perl
|
||||
|
||||
for(@ARGV){
|
||||
/^_$/ and $next_is_env = 0;
|
||||
$next_is_env and push @envvar, split/,/, $_;
|
||||
|
@ -43,7 +45,8 @@ else
|
|||
$vars = join "|",map { quotemeta $_ } @envvar;
|
||||
print $vars ? "($vars)" : "(.*)";
|
||||
'EOF'
|
||||
set _grep_REGEXP="`perl $_tMpscRIpt -- !*`"
|
||||
set _grep_REGEXP="`perl $_tMpscRIpt -- $PARALLEL`"
|
||||
|
||||
# Deal with --env _
|
||||
cat <<'EOF' > $_tMpscRIpt
|
||||
#!/usr/bin/perl
|
||||
|
@ -59,12 +62,13 @@ else
|
|||
} else {
|
||||
chomp(@ignored_vars = <IN>);
|
||||
$vars = join "|",map { quotemeta $_ } @ignored_vars;
|
||||
print $vars ? "($vars)" : "(nOVaRs)";
|
||||
print $vars ? "($vars)" : "(,,nO,,VaRs,,)";
|
||||
}
|
||||
}
|
||||
'EOF'
|
||||
set _ignore_UNDERSCORE="`perl $_tMpscRIpt -- !*`"
|
||||
set _ignore_UNDERSCORE="`perl $_tMpscRIpt -- $PARALLEL`"
|
||||
rm $_tMpscRIpt
|
||||
|
||||
# Get the scalar and array variable names
|
||||
set _vARnAmES=(`set | awk -e '{print $1}' |grep -vE '^(#|_|killring|prompt2|command)$' | grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$`)
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@ env_parallel() {
|
|||
# and convert a b c to (a|b|c)
|
||||
# If --env not set: Match everything (.*)
|
||||
_grep_REGEXP="$(
|
||||
perl -e 'for(@ARGV){
|
||||
perl -e '
|
||||
for(@ARGV){
|
||||
/^_$/ and $next_is_env = 0;
|
||||
$next_is_env and push @envvar, split/,/, $_;
|
||||
$next_is_env = /^--env$/;
|
||||
|
@ -44,18 +45,27 @@ env_parallel() {
|
|||
)"
|
||||
# Deal with --env _
|
||||
local _ignore_UNDERSCORE="$(
|
||||
perl -e 'for(@ARGV){
|
||||
perl -e '
|
||||
for(@ARGV){
|
||||
$next_is_env and push @envvar, split/,/, $_;
|
||||
$next_is_env=/^--env$/;
|
||||
}
|
||||
$underscore = grep { /^_$/ } @envvar;
|
||||
print $underscore ? "grep -vf $ENV{HOME}/.parallel/ignored_vars" : "cat";
|
||||
if(grep { /^_$/ } @envvar) {
|
||||
if(not open(IN, "<", "$ENV{HOME}/.parallel/ignored_vars")) {
|
||||
print STDERR "parallel: Error: ",
|
||||
"Run \"parallel --record-env\" in a clean environment first.\n";
|
||||
} else {
|
||||
chomp(@ignored_vars = <IN>);
|
||||
$vars = join "|",map { quotemeta $_ } @ignored_vars;
|
||||
print $vars ? "($vars)" : "(,,nO,,VaRs,,)";
|
||||
}
|
||||
}
|
||||
' -- "$@"
|
||||
)"
|
||||
|
||||
# Grep alias names
|
||||
_alias_NAMES="$(print -l ${(k)aliases} |
|
||||
egrep "^${_grep_REGEXP}\$" | eval $_ignore_UNDERSCORE )"
|
||||
grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$ )"
|
||||
_list_alias_BODIES="alias "$(echo $_alias_NAMES|xargs)" | perl -pe 's/^/alias /'"
|
||||
if [[ "$_alias_NAMES" = "" ]] ; then
|
||||
# no aliases selected
|
||||
|
@ -65,7 +75,7 @@ env_parallel() {
|
|||
|
||||
# Grep function names
|
||||
_function_NAMES="$(print -l ${(k)functions} |
|
||||
egrep "^${_grep_REGEXP}\$" | eval $_ignore_UNDERSCORE |
|
||||
grep -E "^$_grep_REGEXP\$" | grep -vE "^$_ignore_UNDERSCORE\$" |
|
||||
grep -v '='
|
||||
)"
|
||||
_list_function_BODIES="typeset -f "$(echo $_function_NAMES|xargs)
|
||||
|
@ -78,7 +88,7 @@ env_parallel() {
|
|||
# Grep variable names
|
||||
# The egrep -v is crap and should be better
|
||||
_variable_NAMES="$(print -l ${(k)parameters} |
|
||||
egrep "^${_grep_REGEXP}\$" | eval $_ignore_UNDERSCORE |
|
||||
grep -E "^$_grep_REGEXP"\$ | grep -vE "^$_ignore_UNDERSCORE"\$ |
|
||||
egrep -v '^([-?#!$*@_0]|zsh_eval_context|ZSH_EVAL_CONTEXT|LINENO|IFS|commands|functions|options|aliases|EUID|EGID|UID|GID)$' |
|
||||
egrep -v 'terminfo|funcstack|galiases|keymaps|parameters|jobdirs|dirstack|functrace|funcsourcetrace|zsh_scheduled_events|dis_aliases|dis_reswords|dis_saliases|modules|reswords|saliases|widgets|userdirs|historywords|nameddirs|termcap|dis_builtins|dis_functions|jobtexts|funcfiletrace|dis_galiases|builtins|history|jobstates'
|
||||
)"
|
||||
|
@ -103,14 +113,3 @@ env_parallel() {
|
|||
`which parallel` "$@";
|
||||
unset PARALLEL_ENV;
|
||||
}
|
||||
|
||||
_old_env_parallel() {
|
||||
# env_parallel.zsh
|
||||
export PARALLEL_ENV="$(alias | perl -pe 's/^/alias /'; typeset -p |
|
||||
grep -aFvf <(typeset -pr) |
|
||||
egrep -iav 'ZSH_EVAL_CONTEXT|LINENO=| _=|aliases|^typeset [a-z_]+$'|
|
||||
egrep -av '^(typeset -A (commands|functions|options)|typeset IFS=|..$)|cyan';
|
||||
typeset -f)";
|
||||
parallel "$@";
|
||||
unset PARALLEL_ENV;
|
||||
}
|
||||
|
|
|
@ -108,6 +108,43 @@ _EOF
|
|||
ssh ksh@lo "$myscript"
|
||||
}
|
||||
|
||||
par_pdksh_man() {
|
||||
echo '### pdksh'
|
||||
myscript=$(cat <<'_EOF'
|
||||
echo "### From man env_parallel"
|
||||
|
||||
. `which env_parallel.pdksh`;
|
||||
alias myecho="echo aliases";
|
||||
env_parallel myecho ::: work;
|
||||
env_parallel -S server myecho ::: work;
|
||||
env_parallel --env myecho myecho ::: work;
|
||||
env_parallel --env myecho -S server myecho ::: work
|
||||
|
||||
. `which env_parallel.pdksh`;
|
||||
myfunc() { echo functions $*; };
|
||||
env_parallel myfunc ::: work;
|
||||
env_parallel -S server myfunc ::: work;
|
||||
env_parallel --env myfunc myfunc ::: work;
|
||||
env_parallel --env myfunc -S server myfunc ::: work
|
||||
|
||||
. `which env_parallel.pdksh`;
|
||||
myvar=variables;
|
||||
env_parallel echo "\$myvar" ::: work;
|
||||
env_parallel -S server echo "\$myvar" ::: work;
|
||||
env_parallel --env myvar echo "\$myvar" ::: work;
|
||||
env_parallel --env myvar -S server echo "\$myvar" ::: work
|
||||
|
||||
. `which env_parallel.pdksh`;
|
||||
myarray=(arrays work, too);
|
||||
env_parallel -k echo "\${myarray[{}]}" ::: 0 1 2;
|
||||
env_parallel -k -S server echo "\${myarray[{}]}" ::: 0 1 2;
|
||||
env_parallel -k --env myarray echo "\${myarray[{}]}" ::: 0 1 2;
|
||||
env_parallel -k --env myarray -S server echo "\${myarray[{}]}" ::: 0 1 2
|
||||
_EOF
|
||||
)
|
||||
ssh pdksh@lo "$myscript"
|
||||
}
|
||||
|
||||
par_tcsh_man() {
|
||||
echo '### tcsh'
|
||||
myscript=$(cat <<'_EOF'
|
||||
|
@ -143,7 +180,7 @@ par_csh_man() {
|
|||
myscript=$(cat <<'_EOF'
|
||||
echo "### From man env_parallel"
|
||||
|
||||
source `which env_parallel.csh`;
|
||||
# source `which env_parallel.csh`;
|
||||
|
||||
alias myecho 'echo aliases'
|
||||
env_parallel myecho ::: work
|
||||
|
@ -170,6 +207,43 @@ _EOF
|
|||
ssh csh@lo "$myscript"
|
||||
}
|
||||
|
||||
par_fish_man() {
|
||||
echo '### fish'
|
||||
myscript=$(cat <<'_EOF'
|
||||
echo "### From man env_parallel"
|
||||
|
||||
alias myecho 'echo aliases'
|
||||
env_parallel myecho ::: work
|
||||
env_parallel -S server myecho ::: work
|
||||
env_parallel --env myecho myecho ::: work
|
||||
env_parallel --env myecho -S server myecho ::: work
|
||||
|
||||
function myfunc
|
||||
echo functions $argv
|
||||
end
|
||||
env_parallel myfunc ::: work
|
||||
env_parallel -S server myfunc ::: work
|
||||
env_parallel --env myfunc myfunc ::: work
|
||||
env_parallel --env myfunc -S server myfunc ::: work
|
||||
|
||||
set myvar variables
|
||||
env_parallel echo '$myvar' ::: work
|
||||
env_parallel -S server echo '$myvar' ::: work
|
||||
env_parallel --env myvar echo '$myvar' ::: work
|
||||
env_parallel --env myvar -S server echo '$myvar' ::: work
|
||||
|
||||
set myarray arrays work, too
|
||||
env_parallel -k echo '$myarray[{}]' ::: 1 2 3
|
||||
env_parallel -k -S server echo '$myarray[{}]' ::: 1 2 3
|
||||
env_parallel -k --env myarray echo '$myarray[{}]' ::: 1 2 3
|
||||
env_parallel -k --env myarray -S server echo '$myarray[{}]' ::: 1 2 3
|
||||
|
||||
_EOF
|
||||
)
|
||||
ssh fish@lo "$myscript"
|
||||
}
|
||||
|
||||
|
||||
par_bash_underscore() {
|
||||
echo '### bash'
|
||||
myscript=$(cat <<'_EOF'
|
||||
|
@ -195,14 +269,14 @@ par_bash_underscore() {
|
|||
env_parallel --env _ -S server myfunc ::: work;
|
||||
echo myecho >> ~/.parallel/ignored_vars;
|
||||
env_parallel --env _ myfunc ::: work;
|
||||
echo "OK if no myecho ^^^^^^^^^^^^^^^^^^^^^^^^^" >&2;
|
||||
echo "OK if no myecho ^^^^^^^^^^^^^^^^^^^^^^^^^" >&2;
|
||||
env_parallel --env _ -S server myfunc ::: work;
|
||||
echo "OK if no myecho ^^^^^^^^^^^^^^^^^^^^^^^^^" >&2;
|
||||
echo "OK if no myecho ^^^^^^^^^^^^^^^^^^^^^^^^^" >&2;
|
||||
echo myfunc >> ~/.parallel/ignored_vars;
|
||||
env_parallel --env _ myfunc ::: work;
|
||||
echo "OK if no myfunc ^^^^^^^^^^^^^^^^^^^^^^^^^" >&2;
|
||||
echo "OK if no myfunc ^^^^^^^^^^^^^^^^^^^^^^^^^" >&2;
|
||||
env_parallel --env _ -S server myfunc ::: work;
|
||||
echo "OK if no myfunc ^^^^^^^^^^^^^^^^^^^^^^^^^" >&2;
|
||||
echo "OK if no myfunc ^^^^^^^^^^^^^^^^^^^^^^^^^" >&2;
|
||||
_EOF
|
||||
)
|
||||
ssh bash@lo "$myscript"
|
||||
|
@ -289,6 +363,45 @@ _EOF
|
|||
ssh ksh@lo "$myscript"
|
||||
}
|
||||
|
||||
par_pdksh_underscore() {
|
||||
echo '### pdksh'
|
||||
myscript=$(cat <<'_EOF'
|
||||
echo "### Testing of --env _"
|
||||
|
||||
. `which env_parallel.pdksh`;
|
||||
env_parallel --record-env;
|
||||
alias myecho="echo \$myvar aliases in";
|
||||
myfunc() { myecho ${myarray[@]} functions $*; };
|
||||
myvar="variables in";
|
||||
myarray=(and arrays in);
|
||||
env_parallel myfunc ::: work;
|
||||
env_parallel -S server myfunc ::: work;
|
||||
env_parallel --env myfunc,myvar,myarray,myecho myfunc ::: work;
|
||||
env_parallel --env myfunc,myvar,myarray,myecho -S server myfunc ::: work;
|
||||
env_parallel --env _ myfunc ::: work;
|
||||
env_parallel --env _ -S server myfunc ::: work;
|
||||
|
||||
echo myvar >> ~/.parallel/ignored_vars;
|
||||
env_parallel --env _ myfunc ::: work;
|
||||
env_parallel --env _ -S server myfunc ::: work;
|
||||
echo myarray >> ~/.parallel/ignored_vars;
|
||||
env_parallel --env _ myfunc ::: work;
|
||||
env_parallel --env _ -S server myfunc ::: work;
|
||||
echo myecho >> ~/.parallel/ignored_vars;
|
||||
env_parallel --env _ myfunc ::: work;
|
||||
echo "OK if no myecho ^^^^^^^^^^^^^^^^^" >&2;
|
||||
env_parallel --env _ -S server myfunc ::: work;
|
||||
echo "OK if no myecho ^^^^^^^^^^^^^^^^^" >&2;
|
||||
echo myfunc >> ~/.parallel/ignored_vars;
|
||||
env_parallel --env _ myfunc ::: work;
|
||||
echo "OK if no myfunc ^^^^^^^^^^^^^^^^^" >&2;
|
||||
env_parallel --env _ -S server myfunc ::: work;
|
||||
echo "OK if no myfunc ^^^^^^^^^^^^^^^^^" >&2;
|
||||
_EOF
|
||||
)
|
||||
ssh pdksh@lo "$myscript"
|
||||
}
|
||||
|
||||
par_tcsh_underscore() {
|
||||
echo '### tcsh'
|
||||
myscript=$(cat <<'_EOF'
|
||||
|
@ -328,7 +441,7 @@ par_csh_underscore() {
|
|||
myscript=$(cat <<'_EOF'
|
||||
echo "### Testing of --env _"
|
||||
|
||||
# . `which env_parallel.tcsh`;
|
||||
# . `which env_parallel.csh`;
|
||||
env_parallel --record-env;
|
||||
alias myecho "echo "\$"myvar "\$'myarray'" aliases";
|
||||
set myvar="variables";
|
||||
|
@ -357,6 +470,47 @@ _EOF
|
|||
ssh -tt csh@lo "$myscript"
|
||||
}
|
||||
|
||||
par_fish_underscore() {
|
||||
echo '### fish'
|
||||
myscript=$(cat <<'_EOF'
|
||||
echo "### Testing of --env _"
|
||||
|
||||
# . `which env_parallel.fish`;
|
||||
env_parallel --record-env;
|
||||
alias myecho="echo \$myvar aliases";
|
||||
function myfunc
|
||||
myecho $myarray functions $argv
|
||||
end
|
||||
set myvar "variables in";
|
||||
set myarray and arrays in;
|
||||
env_parallel myfunc ::: work;
|
||||
env_parallel -S server myfunc ::: work;
|
||||
env_parallel --env myfunc,myvar,myarray,myecho myfunc ::: work;
|
||||
env_parallel --env myfunc,myvar,myarray,myecho -S server myfunc ::: work;
|
||||
env_parallel --env _ myfunc ::: work;
|
||||
env_parallel --env _ -S server myfunc ::: work;
|
||||
|
||||
echo myvar >> ~/.parallel/ignored_vars;
|
||||
env_parallel --env _ myfunc ::: work;
|
||||
env_parallel --env _ -S server myfunc ::: work;
|
||||
echo myarray >> ~/.parallel/ignored_vars;
|
||||
env_parallel --env _ myfunc ::: work;
|
||||
env_parallel --env _ -S server myfunc ::: work;
|
||||
echo myecho >> ~/.parallel/ignored_vars;
|
||||
env_parallel --env _ myfunc ::: work;
|
||||
echo "OK if ^^^^^^^^^^^^^^^^^ no myecho" >&2;
|
||||
env_parallel --env _ -S server myfunc ::: work;
|
||||
echo "OK if ^^^^^^^^^^^^^^^^^ no myecho" >&2;
|
||||
echo myfunc >> ~/.parallel/ignored_vars;
|
||||
env_parallel --env _ myfunc ::: work;
|
||||
echo "OK if ^^^^^^^^^^^^^^^^^ no myfunc" >&2;
|
||||
env_parallel --env _ -S server myfunc ::: work;
|
||||
echo "OK if ^^^^^^^^^^^^^^^^^ no myfunc" >&2;
|
||||
_EOF
|
||||
)
|
||||
ssh fish@lo "$myscript"
|
||||
}
|
||||
|
||||
# Test env_parallel:
|
||||
# + for each shell
|
||||
# + remote, locally
|
||||
|
@ -448,6 +602,35 @@ _EOF
|
|||
ssh ksh@lo "$myscript"
|
||||
}
|
||||
|
||||
par_pdksh_funky() {
|
||||
myscript=$(cat <<'_EOF'
|
||||
. `which env_parallel.pdksh`;
|
||||
|
||||
myvar="myvar works"
|
||||
funky=$(perl -e "print pack \"c*\", 1..255")
|
||||
myarray=("" array_val2 3 "" 5 " space 6 ")
|
||||
assocarr[a]=assoc_val_a
|
||||
assocarr[b]=assoc_val_b
|
||||
alias alias_echo="echo 3 arg";
|
||||
func_echo() {
|
||||
echo $*;
|
||||
echo "$myvar"
|
||||
echo "${myarray[5]}"
|
||||
echo ${assocarr[a]}
|
||||
echo Funky-"$funky"-funky
|
||||
}
|
||||
|
||||
env_parallel alias_echo ::: alias_works
|
||||
env_parallel func_echo ::: function_works
|
||||
env_parallel -S lo alias_echo ::: alias_works_over_ssh
|
||||
env_parallel -S lo func_echo ::: function_works_over_ssh
|
||||
echo
|
||||
echo "$funky" | parallel --shellquote
|
||||
_EOF
|
||||
)
|
||||
ssh pdksh@lo "$myscript"
|
||||
}
|
||||
|
||||
par_fish_funky() {
|
||||
myscript=$(cat <<'_EOF'
|
||||
set myvar "myvar works"
|
||||
|
@ -524,6 +707,38 @@ _EOF
|
|||
ssh csh@lo "$myscript"
|
||||
}
|
||||
|
||||
par_tcsh_funky() {
|
||||
myscript=$(cat <<'_EOF'
|
||||
set myvar = "myvar works"
|
||||
set funky = "`perl -e 'print pack q(c*), 2..255'`"
|
||||
set myarray = ('' 'array_val2' '3' '' '5' ' space 6 ')
|
||||
# declare -A assocarr
|
||||
# assocarr[a]=assoc_val_a
|
||||
# assocarr[b]=assoc_val_b
|
||||
alias alias_echo echo 3 arg;
|
||||
alias alias_echo_var 'echo $argv; echo "$myvar"; echo "${myarray[4]} special chars problem"; echo Funky-"$funky"-funky'
|
||||
|
||||
# function func_echo
|
||||
# echo $argv;
|
||||
# echo $myvar;
|
||||
# echo ${myarray[2]}
|
||||
# #echo ${assocarr[a]}
|
||||
# echo Funky-"$funky"-funky
|
||||
# end
|
||||
|
||||
env_parallel alias_echo ::: alias_works
|
||||
env_parallel alias_echo_var ::: alias_var_works
|
||||
env_parallel func_echo ::: function_does_not_work
|
||||
env_parallel -S tcsh@lo alias_echo ::: alias_works_over_ssh
|
||||
env_parallel -S tcsh@lo alias_echo_var ::: alias_var_works_over_ssh
|
||||
env_parallel -S tcsh@lo func_echo ::: function_does_not_work_over_ssh
|
||||
echo
|
||||
echo "$funky" | parallel --shellquote
|
||||
_EOF
|
||||
)
|
||||
ssh tcsh@lo "$myscript"
|
||||
}
|
||||
|
||||
|
||||
export -f $(compgen -A function | grep par_)
|
||||
# Tested with -j1..8
|
||||
|
|
|
@ -62,14 +62,14 @@ par_bash_underscore aliases in and arrays in functions work
|
|||
par_bash_underscore aliases in and arrays in functions work
|
||||
par_bash_underscore aliases in functions work
|
||||
par_bash_underscore aliases in functions work
|
||||
par_bash_underscore /bin/bash: line 64: myecho: command not found
|
||||
par_bash_underscore OK if no myecho ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
par_bash_underscore /bin/bash: line 64: myecho: command not found
|
||||
par_bash_underscore OK if no myecho ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
par_bash_underscore /bin/bash: line 62: myfunc: command not found
|
||||
par_bash_underscore OK if no myfunc ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
par_bash_underscore /bin/bash: line 62: myfunc: command not found
|
||||
par_bash_underscore OK if no myfunc ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
par_bash_underscore /bin/bash: line 139: myecho: command not found
|
||||
par_bash_underscore OK if no myecho ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
par_bash_underscore /bin/bash: line 139: myecho: command not found
|
||||
par_bash_underscore OK if no myecho ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
par_bash_underscore /bin/bash: line 136: myfunc: command not found
|
||||
par_bash_underscore OK if no myfunc ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
par_bash_underscore /bin/bash: line 136: myfunc: command not found
|
||||
par_bash_underscore OK if no myfunc ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
par_csh_funky 3 arg alias_works
|
||||
par_csh_funky myvar works
|
||||
par_csh_funky space special chars problem
|
||||
|
@ -112,13 +112,13 @@ par_csh_underscore variables and arrays in aliases work
|
|||
par_csh_underscore variables and arrays in aliases work
|
||||
par_csh_underscore variables and arrays in aliases work
|
||||
par_csh_underscore variables and arrays in aliases work
|
||||
par_csh_underscore variables and arrays in aliases work
|
||||
par_csh_underscore variables and arrays in aliases work
|
||||
par_csh_underscore and arrays in aliases work
|
||||
par_csh_underscore and arrays in aliases work
|
||||
par_csh_underscore and arrays in aliases work
|
||||
par_csh_underscore myvar: Undefined variable.
|
||||
par_csh_underscore myvar: Undefined variable.
|
||||
par_csh_underscore myarray: Undefined variable.
|
||||
par_csh_underscore myarray: Undefined variable.
|
||||
par_csh_underscore myecho: Command not found.
|
||||
par_csh_underscore OK ^^^^^^^^^^^^^^^^^ if no myecho
|
||||
par_csh_underscore and arrays in aliases work
|
||||
par_csh_underscore myecho: Command not found.
|
||||
par_csh_underscore OK ^^^^^^^^^^^^^^^^^ if no myecho
|
||||
par_csh_underscore Connection to lo closed.
|
||||
par_fish_funky env_parallel: Warning: ASCII value 1 in variables is not supported
|
||||
|
@ -157,6 +157,68 @@ par_fish_funky
|
|||
par_fish_funky
|
||||
par_fish_funky
|
||||
par_fish_funky \\\\\\\\ \ \\\
\\\\\\\\\\\\\\ \ \!\"\#\$%\&\'\(\)\*+,-./0123456789:\;\<\=\>\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]\^_\`abcdefghijklmnopqrstuvwxyz\{\|\}\~€<7F>\‚\ƒ\„\…\†\‡\ˆ\‰\Š\‹\Œ\<5C>\Ž\<5C>\<5C>\‘\’\“\”\•\–\—\˜\™\š\›\œ\<5C>\ž\Ÿ\ \¡\¢\£\¤\¥\¦\§\¨\©\ª\«\¬\\®\¯\°\±\²\³\´\µ\¶\·\¸\¹\º\»\¼\½\¾\¿\À\Á\Â\Ã\Ä\Å\Æ\Ç\È\É\Ê\Ë\Ì\Í\Î\Ï\Ð\Ñ\Ò\Ó\Ô\Õ\Ö\×\Ø\Ù\Ú\Û\Ü\Ý\Þ\ß\à\á\â\ã\ä\å\æ\ç\è\é\ê\ë\ì\í\î\ï\ð\ñ\ò\ó\ô\õ\ö\÷\ø\ù\ú\û\ü\ý\þ\ÿ
|
||||
par_fish_man ### fish
|
||||
par_fish_man ### From man env_parallel
|
||||
par_fish_man aliases work
|
||||
par_fish_man aliases work
|
||||
par_fish_man aliases work
|
||||
par_fish_man aliases work
|
||||
par_fish_man functions work
|
||||
par_fish_man functions work
|
||||
par_fish_man functions work
|
||||
par_fish_man functions work
|
||||
par_fish_man variables work
|
||||
par_fish_man variables work
|
||||
par_fish_man variables work
|
||||
par_fish_man variables work
|
||||
par_fish_man arrays
|
||||
par_fish_man work,
|
||||
par_fish_man too
|
||||
par_fish_man arrays
|
||||
par_fish_man work,
|
||||
par_fish_man too
|
||||
par_fish_man arrays
|
||||
par_fish_man work,
|
||||
par_fish_man too
|
||||
par_fish_man arrays
|
||||
par_fish_man work,
|
||||
par_fish_man too
|
||||
par_fish_underscore ### fish
|
||||
par_fish_underscore ### Testing of --env _
|
||||
par_fish_underscore variables in aliases and arrays in functions work
|
||||
par_fish_underscore variables in aliases and arrays in functions work
|
||||
par_fish_underscore variables in aliases and arrays in functions work
|
||||
par_fish_underscore variables in aliases and arrays in functions work
|
||||
par_fish_underscore variables in aliases and arrays in functions work
|
||||
par_fish_underscore variables in aliases and arrays in functions work
|
||||
par_fish_underscore aliases and arrays in functions work
|
||||
par_fish_underscore aliases and arrays in functions work
|
||||
par_fish_underscore aliases functions work
|
||||
par_fish_underscore aliases functions work
|
||||
par_fish_underscore fish: Unknown command “myechoâ€<C3A2>
|
||||
par_fish_underscore Standard input: myecho $myarray functions $argv
|
||||
par_fish_underscore ^
|
||||
par_fish_underscore in function “myfuncâ€<C3A2>,
|
||||
par_fish_underscore called on standard input,
|
||||
par_fish_underscore with parameter list “workâ€<C3A2>
|
||||
par_fish_underscore
|
||||
par_fish_underscore OK if ^^^^^^^^^^^^^^^^^ no myecho
|
||||
par_fish_underscore fish: Unknown command “myechoâ€<C3A2>
|
||||
par_fish_underscore Standard input: myecho $myarray functions $argv
|
||||
par_fish_underscore ^
|
||||
par_fish_underscore in function “myfuncâ€<C3A2>,
|
||||
par_fish_underscore called on standard input,
|
||||
par_fish_underscore with parameter list “workâ€<C3A2>
|
||||
par_fish_underscore
|
||||
par_fish_underscore OK if ^^^^^^^^^^^^^^^^^ no myecho
|
||||
par_fish_underscore fish: Unknown command “myfuncâ€<C3A2>
|
||||
par_fish_underscore Standard input: myfunc work
|
||||
par_fish_underscore ^
|
||||
par_fish_underscore OK if ^^^^^^^^^^^^^^^^^ no myfunc
|
||||
par_fish_underscore fish: Unknown command “myfuncâ€<C3A2>
|
||||
par_fish_underscore Standard input: myfunc work
|
||||
par_fish_underscore ^
|
||||
par_fish_underscore OK if ^^^^^^^^^^^^^^^^^ no myfunc
|
||||
par_ksh_funky 3 arg alias_works
|
||||
par_ksh_funky function_works
|
||||
par_ksh_funky myvar works
|
||||
|
@ -212,14 +274,91 @@ par_ksh_underscore aliases in and arrays in functions work
|
|||
par_ksh_underscore aliases in and arrays in functions work
|
||||
par_ksh_underscore aliases in functions work
|
||||
par_ksh_underscore aliases in functions work
|
||||
par_ksh_underscore /usr/bin/ksh[100]: myecho: not found [No such file or directory]
|
||||
par_ksh_underscore /usr/bin/ksh[193]: myecho: not found [No such file or directory]
|
||||
par_ksh_underscore OK if no myecho ^^^^^^^^^^^^^^^^^
|
||||
par_ksh_underscore /usr/bin/ksh[100]: myecho: not found [No such file or directory]
|
||||
par_ksh_underscore /usr/bin/ksh[193]: myecho: not found [No such file or directory]
|
||||
par_ksh_underscore OK if no myecho ^^^^^^^^^^^^^^^^^
|
||||
par_ksh_underscore /usr/bin/ksh: line 100: myfunc: not found
|
||||
par_ksh_underscore /usr/bin/ksh: line 193: myfunc: not found
|
||||
par_ksh_underscore OK if no myfunc ^^^^^^^^^^^^^^^^^
|
||||
par_ksh_underscore /usr/bin/ksh: line 100: myfunc: not found
|
||||
par_ksh_underscore /usr/bin/ksh: line 193: myfunc: not found
|
||||
par_ksh_underscore OK if no myfunc ^^^^^^^^^^^^^^^^^
|
||||
par_pdksh_funky 3 arg alias_works
|
||||
par_pdksh_funky function_works
|
||||
par_pdksh_funky myvar works
|
||||
par_pdksh_funky space 6
|
||||
par_pdksh_funky assoc_val_b
|
||||
par_pdksh_funky Funky-
|
||||
par_pdksh_funky
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€<7F>‚ƒ„…†‡ˆ‰Š‹Œ<E280B9>Ž<EFBFBD><C5BD>‘’“”•–—˜™š›œ<E280BA>žŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ-funky
|
||||
par_pdksh_funky 3 arg alias_works_over_ssh
|
||||
par_pdksh_funky function_works_over_ssh
|
||||
par_pdksh_funky myvar works
|
||||
par_pdksh_funky space 6
|
||||
par_pdksh_funky assoc_val_b
|
||||
par_pdksh_funky Funky-
|
||||
par_pdksh_funky
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€<7F>‚ƒ„…†‡ˆ‰Š‹Œ<E280B9>Ž<EFBFBD><C5BD>‘’“”•–—˜™š›œ<E280BA>žŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ-funky
|
||||
par_pdksh_funky
|
||||
par_pdksh_funky \\\\\\\\
|
||||
par_pdksh_funky \\\
\\\\\\\\\\\\\\ \!\"\#\$%\&\'\(\)\*+,-./0123456789:\;\<\=\>\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]\^_\`abcdefghijklmnopqrstuvwxyz\{\|\}\~€<7F>\‚\ƒ\„\…\†\‡\ˆ\‰\Š\‹\Œ\<5C>\Ž\<5C>\<5C>\‘\’\“\”\•\–\—\˜\™\š\›\œ\<5C>\ž\Ÿ\ \¡\¢\£\¤\¥\¦\§\¨\©\ª\«\¬\\®\¯\°\±\²\³\´\µ\¶\·\¸\¹\º\»\¼\½\¾\¿\À\Á\Â\Ã\Ä\Å\Æ\Ç\È\É\Ê\Ë\Ì\Í\Î\Ï\Ð\Ñ\Ò\Ó\Ô\Õ\Ö\×\Ø\Ù\Ú\Û\Ü\Ý\Þ\ß\à\á\â\ã\ä\å\æ\ç\è\é\ê\ë\ì\í\î\ï\ð\ñ\ò\ó\ô\õ\ö\÷\ø\ù\ú\û\ü\ý\þ\ÿ
|
||||
par_pdksh_man ### pdksh
|
||||
par_pdksh_man ### From man env_parallel
|
||||
par_pdksh_man aliases work
|
||||
par_pdksh_man aliases work
|
||||
par_pdksh_man aliases work
|
||||
par_pdksh_man aliases work
|
||||
par_pdksh_man functions work
|
||||
par_pdksh_man functions work
|
||||
par_pdksh_man functions work
|
||||
par_pdksh_man functions work
|
||||
par_pdksh_man variables work
|
||||
par_pdksh_man variables work
|
||||
par_pdksh_man variables work
|
||||
par_pdksh_man variables work
|
||||
par_pdksh_man arrays
|
||||
par_pdksh_man work,
|
||||
par_pdksh_man too
|
||||
par_pdksh_man arrays
|
||||
par_pdksh_man work,
|
||||
par_pdksh_man too
|
||||
par_pdksh_man arrays
|
||||
par_pdksh_man work,
|
||||
par_pdksh_man too
|
||||
par_pdksh_man arrays
|
||||
par_pdksh_man work,
|
||||
par_pdksh_man too
|
||||
par_pdksh_underscore ### pdksh
|
||||
par_pdksh_underscore ### Testing of --env _
|
||||
par_pdksh_underscore variables in aliases in and arrays in functions work
|
||||
par_pdksh_underscore variables in aliases in and arrays in functions work
|
||||
par_pdksh_underscore variables in aliases in and arrays in functions work
|
||||
par_pdksh_underscore variables in aliases in and arrays in functions work
|
||||
par_pdksh_underscore variables in aliases in and arrays in functions work
|
||||
par_pdksh_underscore variables in aliases in and arrays in functions work
|
||||
par_pdksh_underscore aliases in and arrays in functions work
|
||||
par_pdksh_underscore aliases in and arrays in functions work
|
||||
par_pdksh_underscore aliases in functions work
|
||||
par_pdksh_underscore aliases in functions work
|
||||
par_pdksh_underscore aliases in functions work
|
||||
par_pdksh_underscore OK if no myecho ^^^^^^^^^^^^^^^^^
|
||||
par_pdksh_underscore aliases in functions work
|
||||
par_pdksh_underscore OK if no myecho ^^^^^^^^^^^^^^^^^
|
||||
par_pdksh_underscore /bin/pdksh: myfunc: not found
|
||||
par_pdksh_underscore OK if no myfunc ^^^^^^^^^^^^^^^^^
|
||||
par_pdksh_underscore /bin/pdksh: myfunc: not found
|
||||
par_pdksh_underscore OK if no myfunc ^^^^^^^^^^^^^^^^^
|
||||
par_tcsh_funky 3 arg alias_works
|
||||
par_tcsh_funky
|
||||
par_tcsh_funky myvar works
|
||||
par_tcsh_funky space special chars problem
|
||||
par_tcsh_funky Funky-
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€<7F>‚ƒ„…†‡ˆ‰Š‹Œ<E280B9>Ž<EFBFBD><C5BD>‘’“”•–—˜™š›œ<E280BA>žŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùú-funky alias_var_works
|
||||
par_tcsh_funky func_echo: Command not found.
|
||||
par_tcsh_funky 3 arg alias_works_over_ssh
|
||||
par_tcsh_funky
|
||||
par_tcsh_funky myvar works
|
||||
par_tcsh_funky space special chars problem
|
||||
par_tcsh_funky Funky-
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€<7F>‚ƒ„…†‡ˆ‰Š‹Œ<E280B9>Ž<EFBFBD><C5BD>‘’“”•–—˜™š›œ<E280BA>žŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùú-funky alias_var_works_over_ssh
|
||||
par_tcsh_funky func_echo: Command not found.
|
||||
par_tcsh_funky
|
||||
par_tcsh_funky \\\\\\\\ \ \\\
\\\\\\\\\\\\\\ \!\"\#\$%\&\'\(\)\*+,-./0123456789:\;\<\=\>\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]\^_\`abcdefghijklmnopqrstuvwxyz\{\|\}\~€<7F>\‚\ƒ\„\…\†\‡\ˆ\‰\Š\‹\Œ\<5C>\Ž\<5C>\<5C>\‘\’\“\”\•\–\—\˜\™\š\›\œ\<5C>\ž\Ÿ\ \¡\¢\£\¤\¥\¦\§\¨\©\ª\«\¬\\®\¯\°\±\²\³\´\µ\¶\·\¸\¹\º\»\¼\½\¾\¿\À\Á\Â\Ã\Ä\Å\Æ\Ç\È\É\Ê\Ë\Ì\Í\Î\Ï\Ð\Ñ\Ò\Ó\Ô\Õ\Ö\×\Ø\Ù\Ú\Û\Ü\Ý\Þ\ß\à\á\â\ã\ä\å\æ\ç\è\é\ê\ë\ì\í\î\ï\ð\ñ\ò\ó\ô\õ\ö\÷\ø\ù\ú
|
||||
par_tcsh_man ### tcsh
|
||||
par_tcsh_man ### From man env_parallel
|
||||
par_tcsh_man aliases work
|
||||
|
|
Loading…
Reference in a new issue