bug-parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU Parallel Bug Reports which shell is invoked (Was: why is paralle


From: Ole Tange
Subject: Re: GNU Parallel Bug Reports which shell is invoked (Was: why is parallel invoking a shell **by default** and associated bugs)
Date: Sun, 31 May 2015 16:22:15 +0200

On Tue, May 26, 2015 at 9:39 AM, Stephane Chazelas
<address@hidden> wrote:

> 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

Yikes. I did not know that some shells use exec if it is the only command.

> $ bash -c ":;parallel 'readlink /proc/\$\$/exe;true' ::: 1"
> /bin/bash

Though it is probably better to write 'true;' as that ought to work in
all shells.

And even better would be to append '&& true':

zsh% ksh -c "true;parallel 'readlink /proc/\$\$/exe;true' ::: 1"
/bin/zsh5

zsh% ksh -c "parallel 'readlink /proc/\$\$/exe;true' ::: 1 && true"
/bin/ksh93

> 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 is expected and should be covered in parallel_design.


/Ole



reply via email to

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