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

Re: set -e (no && or ||)



On Oct 12, 12:53pm, Peter Stephenson wrote:
} Subject: Re: set -e (no && or ||)
}
} On Fri, 12 Oct 2012 07:05:41 -0400
} Sergey Fadeev <hindsight@xxxxxxxxx> wrote:
} 
} > Why doesn't it exit the shell?
} >  $ set -e
} >  $ echo $(false)
} >  Shouldn't the error code of $(false) command substitution be checked
} > by set -e before passing stdout to the echo builtin?
} 
} No, because the command was "echo", and that didn't fail.

The idea being that not every nonzero status is an error, and -e means
to exit on error.

For example, you generally don't want the shell to exit on something
like this:

	while read line
	then echo This should eventually stop
	fi
	echo But you probably want to arrive here without exiting



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