mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 22:17:54 +00:00
Fixed bug #48327: env_parallel.bash fails if function has ().
This commit is contained in:
parent
9d1e2df9b9
commit
85dfb3e96a
|
@ -33,7 +33,7 @@ while test $# -gt 0; do
|
||||||
grep env_parallel.ksh $HOME/.kshrc 2>/dev/null ||
|
grep env_parallel.ksh $HOME/.kshrc 2>/dev/null ||
|
||||||
echo 'source `which env_parallel.ksh`' >> $HOME/.kshrc
|
echo 'source `which env_parallel.ksh`' >> $HOME/.kshrc
|
||||||
grep env_parallel.pdksh $HOME/.profile 2>/dev/null ||
|
grep env_parallel.pdksh $HOME/.profile 2>/dev/null ||
|
||||||
echo 'source `which env_parallel.pdksh`' >> $HOME/.profile
|
echo '. `which env_parallel.pdksh`' >> $HOME/.profile
|
||||||
grep env_parallel.csh $HOME/.cshrc 2>/dev/null ||
|
grep env_parallel.csh $HOME/.cshrc 2>/dev/null ||
|
||||||
echo 'source `which env_parallel.csh`' >> $HOME/.cshrc
|
echo 'source `which env_parallel.csh`' >> $HOME/.cshrc
|
||||||
grep env_parallel.tcsh $HOME/.tcshrc 2>/dev/null ||
|
grep env_parallel.tcsh $HOME/.tcshrc 2>/dev/null ||
|
||||||
|
@ -78,7 +78,7 @@ ksh: Put this in $HOME/.kshrc: source `which env_parallel.ksh`
|
||||||
Supports: aliases, functions, variables, arrays
|
Supports: aliases, functions, variables, arrays
|
||||||
|
|
||||||
pdksh: Put this in $HOME/.profile: source `which env_parallel.pdksh`
|
pdksh: Put this in $HOME/.profile: source `which env_parallel.pdksh`
|
||||||
E.g. by doing: echo 'source `which env_parallel.pdksh`' >> $HOME/.profile
|
E.g. by doing: echo '. `which env_parallel.pdksh`' >> $HOME/.profile
|
||||||
Supports: aliases, functions, variables, arrays
|
Supports: aliases, functions, variables, arrays
|
||||||
|
|
||||||
csh: Put this in $HOME/.cshrc: source `which env_parallel.csh`
|
csh: Put this in $HOME/.cshrc: source `which env_parallel.csh`
|
||||||
|
|
|
@ -26,11 +26,20 @@
|
||||||
# Fifth Floor, Boston, MA 02110-1301 USA
|
# Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
# Supports env of 127426 bytes
|
# Supports env of 127426 bytes
|
||||||
|
|
||||||
env_parallel() {
|
env_parallel() {
|
||||||
export PARALLEL_ENV="$(echo "shopt -s expand_aliases 2>/dev/null"; alias;typeset -p |
|
# env_parallel.bash
|
||||||
|
PARALLEL_ENV="$(alias;
|
||||||
|
typeset -p |
|
||||||
grep -vFf <(readonly) |
|
grep -vFf <(readonly) |
|
||||||
grep -v 'declare .. (GROUPS|FUNCNAME|DIRSTACK|_|PIPESTATUS|USERNAME|BASH_[A-Z_]+) ';
|
grep -v 'declare .. (GROUPS|FUNCNAME|DIRSTACK|_|PIPESTATUS|USERNAME|BASH_[A-Z_]+) ';
|
||||||
typeset -f)";
|
typeset -f)";
|
||||||
|
# Copy shopt (so e.g. extended globbing works)
|
||||||
|
parallel_shopt="$(shopt 2>/dev/null |
|
||||||
|
perl -pe 's:\s+off:;: and s/^/shopt -u /;
|
||||||
|
s:\s+on:;: and s/^/shopt -s /;')"
|
||||||
|
export PARALLEL_ENV="$parallel_shopt$PARALLEL_ENV"
|
||||||
|
unset parallel_shopt;
|
||||||
`which parallel` "$@";
|
`which parallel` "$@";
|
||||||
unset PARALLEL_ENV;
|
unset PARALLEL_ENV;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
# separator.
|
# separator.
|
||||||
|
|
||||||
function env_parallel
|
function env_parallel
|
||||||
|
# env_parallel.fish
|
||||||
setenv PARALLEL_ENV (
|
setenv PARALLEL_ENV (
|
||||||
begin;
|
begin;
|
||||||
# Export function definitions
|
# Export function definitions
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
# Fifth Floor, Boston, MA 02110-1301 USA
|
# Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
env_parallel() {
|
env_parallel() {
|
||||||
|
# env_parallel.ksh
|
||||||
export PARALLEL_ENV="$(alias | perl -pe 's/^/alias /';typeset -p|egrep -v 'typeset( -i)? -r|PIPESTATUS';typeset -f)";
|
export PARALLEL_ENV="$(alias | perl -pe 's/^/alias /';typeset -p|egrep -v 'typeset( -i)? -r|PIPESTATUS';typeset -f)";
|
||||||
`which parallel` "$@";
|
`which parallel` "$@";
|
||||||
unset PARALLEL_ENV;
|
unset PARALLEL_ENV;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
# Fifth Floor, Boston, MA 02110-1301 USA
|
# Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
env_parallel() {
|
env_parallel() {
|
||||||
|
# env_parallel.pdksh
|
||||||
export PARALLEL_ENV="$(alias | perl -pe 's/^/alias /';typeset -p|egrep -v 'typeset( -i)? -r|PIPESTATUS';typeset -f)";
|
export PARALLEL_ENV="$(alias | perl -pe 's/^/alias /';typeset -p|egrep -v 'typeset( -i)? -r|PIPESTATUS';typeset -f)";
|
||||||
`which parallel` "$@";
|
`which parallel` "$@";
|
||||||
unset PARALLEL_ENV;
|
unset PARALLEL_ENV;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
# Fifth Floor, Boston, MA 02110-1301 USA
|
# Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
env_parallel() {
|
env_parallel() {
|
||||||
|
# env_parallel.zsh
|
||||||
export PARALLEL_ENV="$(alias | perl -pe 's/^/alias /'; typeset -p |
|
export PARALLEL_ENV="$(alias | perl -pe 's/^/alias /'; typeset -p |
|
||||||
grep -aFvf <(typeset -pr) |
|
grep -aFvf <(typeset -pr) |
|
||||||
egrep -iav 'ZSH_EVAL_CONTEXT|LINENO=| _=|aliases|^typeset [a-z_]+$'|
|
egrep -iav 'ZSH_EVAL_CONTEXT|LINENO=| _=|aliases|^typeset [a-z_]+$'|
|
||||||
|
|
|
@ -1195,7 +1195,7 @@ sub check_invalid_option_combinations {
|
||||||
|
|
||||||
sub init_globals {
|
sub init_globals {
|
||||||
# Defaults:
|
# Defaults:
|
||||||
$Global::version = 20160622;
|
$Global::version = 20160627;
|
||||||
$Global::progname = 'parallel';
|
$Global::progname = 'parallel';
|
||||||
$Global::infinity = 2**31;
|
$Global::infinity = 2**31;
|
||||||
$Global::debug = 0;
|
$Global::debug = 0;
|
||||||
|
|
|
@ -614,6 +614,17 @@ echo '### bug #48295: --results should be dynamic like --wd'
|
||||||
|
|
||||||
echo '**'
|
echo '**'
|
||||||
|
|
||||||
|
bash -O extglob -c '. `which env_parallel.bash`;
|
||||||
|
_longopt () {
|
||||||
|
case "$prev" in
|
||||||
|
--+([-a-z0-9_]))
|
||||||
|
echo foo;;
|
||||||
|
esac;
|
||||||
|
};
|
||||||
|
env_parallel echo ::: env_parallel 2>&1
|
||||||
|
'
|
||||||
|
|
||||||
|
echo '**'
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
echo '### 1 .par file from --files expected'
|
echo '### 1 .par file from --files expected'
|
||||||
|
|
|
@ -1676,6 +1676,10 @@ B b
|
||||||
/tmp/parallel-48295/B/1/B/2/b/stderr
|
/tmp/parallel-48295/B/1/B/2/b/stderr
|
||||||
/tmp/parallel-48295/B/1/B/2/b/stdout
|
/tmp/parallel-48295/B/1/B/2/b/stdout
|
||||||
echo '**'
|
echo '**'
|
||||||
|
**
|
||||||
|
bash -O extglob -c '. `which env_parallel.bash`; _longopt () { case "$prev" in --+([-a-z0-9_])) echo foo;; esac; }; env_parallel echo ::: env_parallel 2>&1 '
|
||||||
|
env_parallel
|
||||||
|
echo '**'
|
||||||
**
|
**
|
||||||
### 1 .par file from --files expected
|
### 1 .par file from --files expected
|
||||||
0
|
0
|
||||||
|
|
Loading…
Reference in a new issue