mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-25 23:47:53 +00:00
parallel: Fixed bug #40137: SHELL not bash: Warning when exporting funcs.
This commit is contained in:
parent
2bbfdfec60
commit
358b9091f6
|
@ -1093,6 +1093,12 @@ sub parse_env_var {
|
|||
my @qcsh = map { my $a=$_; "setenv $a " . env_quote($ENV{$a}) } @vars;
|
||||
my @qbash = map { my $a=$_; "export $a=" . env_quote($ENV{$a}) } @vars;
|
||||
my @bash_functions = grep { substr($ENV{$_},0,4) eq "() {" } @vars;
|
||||
if(@bash_functions) {
|
||||
# Functions are not supported for all shells
|
||||
if($ENV{'SHELL'} !~ m:/(bash|rbash|zsh|rzsh|dash|ksh):) {
|
||||
::warning("Shell functions may not be supported in $ENV{'SHELL'}\n");
|
||||
}
|
||||
}
|
||||
push @qbash, map { my $a=$_; "eval $a\"\$$a\"" } @bash_functions;
|
||||
|
||||
# Create lines like:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -j10 -k -L1
|
||||
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | stdout parallel -j10 -k -L1
|
||||
echo '### Test bug #34241: --pipe should not spawn unneeded processes'
|
||||
seq 5 | ssh csh@lo parallel -k --block 5 --pipe -j10 cat\\\;echo Block_end
|
||||
|
||||
|
@ -9,6 +9,10 @@ echo '### --env _'
|
|||
echo '### --env _ with explicit mentioning of normally ignored var $DISPLAY'
|
||||
fUbAr="OK FUBAR" parallel -S csh@lo --env DISPLAY,_ echo '$fUbAr $DISPLAY' ::: test
|
||||
|
||||
echo 'bug #40137: SHELL not bash: Warning when exporting funcs'
|
||||
. <(printf 'myfunc() {\necho $1\n}'); export -f myfunc; parallel --env myfunc -S lo myfunc ::: no_warning
|
||||
. <(printf 'myfunc() {\necho $1\n}'); export -f myfunc; SHELL=/bin/sh parallel --env myfunc -S lo myfunc ::: warning
|
||||
|
||||
echo '### --filter-hosts --slf <()'
|
||||
parallel --nonall --filter-hosts --slf <(echo localhost) echo OK
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@ Block_end
|
|||
DISPLAY: Undefined variable.
|
||||
### --env _ with explicit mentioning of normally ignored var $DISPLAY
|
||||
OK FUBAR :0.0 test
|
||||
bug #40137: SHELL not bash: Warning when exporting funcs
|
||||
no_warning
|
||||
warning
|
||||
parallel: Warning: Shell functions may not be supported in /bin/sh
|
||||
### --filter-hosts --slf <()
|
||||
OK
|
||||
### bug #40002: --files and --nonall seem not to work together:
|
||||
|
|
Loading…
Reference in a new issue