Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Safe scripting



Richard Hartmann wrote:
> On Wed, Jan 21, 2009 at 10:43, Thorsten Kampe <thorsten@xxxxxxxxxxxxxxxx> wro
> te:
> 
> Atom's solution is rather magic, but works very well. If you want to be
> portable, you can also do
> 
> cd foo       || exit 10
> rm bar       || exit 11
> cd foobar    || exit 12
> rm foobarbar || exit 13

"setopt errexit" should also be portable if done as "set -e".

If you just want to return from a function rather than exit a script,
"setopt errreturn", which is specific to zsh.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



Messages sorted by: Reverse Date, Date, Thread, Author