Putting the -e in the first line of the shell script is considered bad practice 
anyway. If correct operation of the script requires aborting on error then you 
don't want someone debugging it with "bash -x scriptname" to accidentally stop 
that.

On 23 December 2016 2:14:55 am LHDT, Craig Sanders via luv-main 
<luv-main@luv.asn.au> wrote:
>On Fri, Dec 23, 2016 at 01:37:11AM +1100, Craig Sanders wrote:
>> one of the worst problems with doing it is that it breaks the ability
>> to pass command-line options to the interpreter in the #! line - e.g.
>> '#!/bin/bash -e' works, but with '#!/usr/bin/env bash -e' the '-e' is
>> ignored by bash.
>
>that's not quite true. it's not that bash ignores the '-e', it's that
>env tries to run a non-existent program called 'bash -e'
>
>e.g.
>
>$ cat foo.bash
>#!/usr/bin/env bash -e
>
>echo foo
>
>$ ./foo.bash
>/usr/bin/env: ‘bash -e’: No such file or directory
>
>
>IMO, that's an unmistakable signal that env was not intended to be used
>in this way.
>
>
>
>IIRC some versions of env (not the one in GNU coreutils, which is
>installed on almost every linux system - with some embedded or
>busybox/tinybox systems being the exceptions) will still run the
>correct
>interpreter but fails to pass on any options.
>
>craig
>
>--
>craig sanders <c...@taz.net.au>
>_______________________________________________
>luv-main mailing list
>luv-main@luv.asn.au
>https://lists.luv.asn.au/cgi-bin/mailman/listinfo/luv-main

-- 
Sent from my Nexus 6P with K-9 Mail.
_______________________________________________
luv-main mailing list
luv-main@luv.asn.au
https://lists.luv.asn.au/cgi-bin/mailman/listinfo/luv-main

Reply via email to