Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Safe scripting
- X-seq: zsh-users 13730
- From: Thorsten Kampe <thorsten@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Safe scripting
- Date: Wed, 21 Jan 2009 10:43:07 +0100
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Sender: news <news@xxxxxxxxxxxxx>
Hi,
what is the best way to detect errors in a (zsh) script?
Or to be more specific: shell scripts (in contrast to other scripting
languages) keep on running even if an error occurs. How can I detect
errors in a script and exit if one occurs?
Say, I have a sequence of commands that all depend on each other:
cd foo
rm bar
cd foobar
rm foobarbar
I could query each commands return code like
if cd foo;
then if rm bar;
then if cd foobar;
then rm foobarbar; fi; fi; fi
But of course that looks to weird. So what would you suggest?!
Thorsten
Messages sorted by:
Reverse Date,
Date,
Thread,
Author