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 23:57:10 +0200

On Sun, May 31, 2015 at 10:14 PM, Stephane Chazelas
<address@hidden> wrote:
> 2015-05-31 16:22:15 +0200, Ole Tange:
>> On Tue, May 26, 2015 at 9:39 AM, Stephane Chazelas
>> <address@hidden> wrote:
>>
:
>> > $ 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.
>
> Most shells do.

Bash and zsh do, but it seems those are the exceptions:

$ fish -c "parallel 'readlink /proc/(echo %self)/exe;true' ::: 1"; echo $?
/usr/bin/fish
0
$ csh -c "parallel 'readlink /proc/\$\$/exe;true' ::: 1"; echo $?
/bin/bsd-csh
0
$ sh -c "parallel 'readlink /proc/\$\$/exe;true' ::: 1"; echo $?
/bin/dash
0
$ pdksh -c "parallel 'readlink /proc/\$\$/exe;true' ::: 1"; echo $?
/bin/lksh
0
$ mksh -c "parallel 'readlink /proc/\$\$/exe;true' ::: 1"; echo $?
/bin/mksh
0
$ fdsh -c "parallel 'readlink /proc/\$\$/exe;true' ::: 1"; echo $?
/usr/bin/fd
0
$ posh -c "parallel 'readlink /proc/\$\$/exe;true' ::: 1"; echo $?
/bin/posh
0
$ sash -c "parallel 'readlink /proc/\$\$/exe;true' ::: 1"; echo $?
/bin/dash
0
$ tcsh -c "parallel 'readlink /proc/\$\$/exe;true' ::: 1"; echo $?
/usr/bin/tcsh
0

>> > $ 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
> [...]
>
> Or you can use "; exit".

Does not work for (t)csh, whereas '&& true' works, so I will put '&&
true' in the manual.

> Again, that transforms a death by signal n to a exit(128+n) (and
> wastes a process).

Wasting a process is the least of my worries.

I really do not feel the shells' behaviours adhere to Principle of
Least Astonishment.


/Ole



reply via email to

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