[u-u] Sams book
Jim Mercer
jim at reptiles.org
Fri Jan 15 15:41:31 EST 2016
On Fri, Jan 15, 2016 at 03:25:57PM -0500, D. Hugh Redelmeier wrote:
> | From: Jim Mercer <jim at reptiles.org>
>
> | -e completely changes the way the shell runs, and i highly suggest never
> | enabling it.
> |
> | for example, if you have anything like
> |
> | #! /bin/sh
> |
> | someprog -a -b -c
> | if [ $? -ne 0 ] ; then
> | take some action
> | fi
>
> More clearly written as:
> someprog -a -b -c || take some action
> or
> if ! someprog -a -b -c ; then
> take some action
> fi
for some other definition of 'clearly' than i'm used to.
:-)
> And these are faster on the original Bourne shell (where [ was not a builtin).
if speed is a factor, bourne shell might not be the appropriate tool.
> | it totally will not do what you think.
>
> I agree that it is a change in how one thinks. A good one.
and you problably like perl too.
:-)
> | i lost a chunk of hair trying to figure out why a script were failing
> | silently, then discovered that someone had put in "#! /bin/bash -e"
>
> I like to be able to say "bash -x scriptname" so putting the flag in
> the shebang is not appropriate.
yep, but, apparently adding args to shebang is getting to be all the rage these days.
--
Jim Mercer Reptilian Research jim at reptiles.org +1 416 410-5633
Life should not be a journey to the grave with the intention of
arriving safely in a pretty and well preserved body, but rather
to skid in broadside in a cloud of smoke, thoroughly used up,
totally worn out, and loudly proclaiming "Wow! What a Ride!"
-- Hunter S. Thompson
More information about the u-u
mailing list