env_parallel.bash: Ignore output from shopt.

env_parallel.zsh: Reverted change.
This commit is contained in:
Ole Tange 2016-08-02 01:25:14 +02:00
parent dc247b78cb
commit cd9b2a4c24
3 changed files with 19 additions and 20 deletions

View file

@ -100,8 +100,9 @@ env_parallel() {
export PARALLEL_ENV="$(
shopt 2>/dev/null |
perl -pe 's:\s+off:;: and s/^/shopt -u /;
s:\s+on:;: and s/^/shopt -s /;';
echo 'shopt -s expand_aliases 2>/dev/null';
s:\s+on:;: and s/^/shopt -s /;
s:;$:&>/dev/null;:';
echo 'shopt -s expand_aliases &>/dev/null';
$_list_alias_BODIES;
$_list_variable_VALUES;
$_list_function_BODIES)";

View file

@ -127,9 +127,9 @@ 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
@ -139,18 +139,17 @@ Not supported by B<csh>.
=item variables
set myvar=test
env_parallel echo "\$myvar" ::: test
env_parallel -S csh@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 with no special chars
set myarray=(foo bar baz)
env_parallel echo "\${myarray\[\{\}\]}" ::: 1 2 3
env_parallel -S csh@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
@ -410,10 +409,10 @@ E.g. by doing:
=item arrays
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
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

View file

@ -100,11 +100,10 @@ env_parallel() {
_list_variable_VALUES="true"
fi
unset _variable_NAMES
export PARALLEL_ENV="$(
eval $_list_alias_BODIES >/dev/null;
eval $_list_function_BODIES >/dev/null;
eval $_list_variable_VALUES >/dev/null;
eval $_list_alias_BODIES;
eval $_list_function_BODIES;
eval $_list_variable_VALUES;
)";
unset _list_alias_BODIES
unset _list_variable_VALUES