parallel
[Top][All Lists]
Advanced

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

Re: singleton for script with shebang


From: Bradley Asztalos
Subject: Re: singleton for script with shebang
Date: Fri, 2 Jan 2015 02:11:17 -0800

And yes I'm aware of the problems with shebang length and also the difference between being able to call an interpreter from shebang on different Unixes.

Cheers,

Bradley

On Fri, Jan 2, 2015 at 2:07 AM, Bradley Asztalos <brad@customweather.com> wrote:
Ole,

No, I did not say anything about Shlomi being right, just that you are clever, in the good sense. To me it is great to be able to use shebang, and it is not overly "clever" at all, in the bad sense.  I often use the /usr/bin/timeout command and parallel + a command + arguments in crontab entries and other shell scripts and that gets unwieldy, so it is rather nice to be able to use shebang to encapsulate at least the parallel part of the command line.

Cheers,

Bradley

On Fri, Jan 2, 2015 at 1:55 AM, Ole Tange <ole@tange.dk> wrote:
On Fri, Jan 2, 2015 at 8:14 AM, Shlomi Fish <shlomif@shlomifish.org> wrote:
> On Thu, 1 Jan 2015 13:54:57 -0800
> Bradley Asztalos <brad@customweather.com> wrote:
:
>> [... shebang ...]
>
> parallel is written in Perl 5 and uses «#!/usr/bin/perl» or whatever as a
> shebang. As a result it cannot be itself used as a she-bang processor.

So why is Shlomi right, when it is clearly possible to use GNU
Parallel as shebang program?

It is because on some UNIX systems this is actually true. On FreeBSD
you need to do:

  #!/usr/bin/env -S parallel --shebang-wrap ...

On other UNIXes there is no work around.

> Furthermore, I should note that in programming, it is a good idea to stick to
> the https://en.wikipedia.org/wiki/KISS_principle and not try to be as clever as
> possible.

Sometimes the code is simpler if GNU Parallel is put in the shebang
line. But it does carry some limitations. The length of the shebang
line is quite limited on many systems, and often the systems will
simply chop it off without any warning.

See http://www.in-ulm.de/~mascheck/various/shebang/#length


/Ole




reply via email to

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