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

Re: Insidious exit status bugs



Peter Stephenson wrote:
>First: the exit status from the `...` or $(...) is being explicitly
>passed back as lastval, i.e. $?.  Why???  There's a variable cmdoutval
>whose only function in life is to remember that status to be assigned
>to lastval, so someone thought it was a good idea.

Assignments such as

	foo=$(grep -l foo *)

are supposed to set $? to the exit status of the $() command.  POSIX.2
clause 3.9.1 requires this.

-zefram



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