On Friday, 23 December 2016 3:07:09 PM AEDT Craig Sanders via luv-main wrote:
> On Fri, Dec 23, 2016 at 02:35:06PM +1100, Russell Coker wrote:
> > Putting the -e in the first line of the shell script is considered bad
> > practice anyway.
> 
> that's debatable. some think it's bad practice. some think it's using bash
> as it's documented to work.

While it is documented to work that way doesn't mean it's a good idea to do 
it.

cd $DIR
rm -rf *

For example if a script has the above 2 lines then a failure to change 
directory will be catastrohic (and it's something I've seen in production more 
than once).  If you are writing your own scripts then you can avoid such 
things, but in a typical sysadmin team it's best to have "set -e" near the top 
of scripts.

> As mentioned, the problem is even worse if used with other languages. e.g
> the following perl script works and produces useful (and expected) output:

Agreed.

-- 
My Main Blog         http://etbe.coker.com.au/
My Documents Blog    http://doc.coker.com.au/

_______________________________________________
luv-main mailing list
[email protected]
https://lists.luv.asn.au/cgi-bin/mailman/listinfo/luv-main

Reply via email to