[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GNU Parallel Bug Reports which shell is invoked (Was: why is parallel in
GNU Parallel Bug Reports which shell is invoked (Was: why is parallel invoking a shell **by default** and associated bugs)
Tue, 26 May 2015 08:39:39 +0100
2015-05-25 22:08:03 +0200, Ole Tange:
> > At the moment, depending on the shell (and it's not always clear
> > which one you'll get)
> Please read:
> If it is still not clear then please explain a situation which is not
> covered by that.
The problem is that "called from a shell" is not very clear and
parallel doesn't (and often can't) always get it right.
In most shells, the last command in an inline script is executed
in the same process (without forking a new process) (with bash,
only when there's one command...)
$ bash -c "parallel 'readlink /proc/\$\$/exe;true' ::: 1"
/bin/zsh5 # my interactive shell
$ bash -c ":;parallel 'readlink /proc/\$\$/exe;true' ::: 1"
Same if you use "exec" in a script (as typical in shell script
$ cat a
exec parallel 'readlink /proc/$$/exe;true' ::: 1
$ ksh a
That's the kind of thing I had in mind with "the need to
outsmart it": that's nice that parallel manages to guess the
calling shell, but you need to know how it does it (or use
PARALLEL_SHELL) so that it be reliable in some contexts.