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

Re: Safe scripting



On Wed, Jan 21, 2009 at 10:43, Thorsten Kampe <thorsten@xxxxxxxxxxxxxxxx> wrote:

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

That is very basic and can be extended, for example with

cd foo       || my_handler 'error foo' '10'

function my_handler() {
	echo $1 $2
}

etc, etc.


Richard



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