bug-parallel
[Top][All Lists]
Advanced

[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


From: Stephane Chazelas
Subject: GNU Parallel Bug Reports which shell is invoked (Was: why is parallel invoking a shell **by default** and associated bugs)
Date: Tue, 26 May 2015 08:39:39 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

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: 
> http://www.gnu.org/software/parallel/parallel_design.html#Which-shell-to-use
> 
> 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"
/bin/bash

Same if you use "exec" in a script (as typical in shell script
wrappers):

$ cat a
exec parallel 'readlink /proc/$$/exe;true' ::: 1
$ ksh a
/bin/zsh5

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.

-- 
Stephane



reply via email to

[Prev in Thread] Current Thread [Next in Thread]