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

Re: error code for failure to execute



Clint Adams wrote:
> Does this make sense?
> 
> $ touch /tmp/nonex
> $ chmod 0 /tmp/nonex
> $ (/tmp/nonex) 2>/dev/null || echo $?
> 127
> $ (/tmp/nonex)
> zsh: permission denied: /tmp/nonex
> $ echo $?
> 126
> $ (/tmp/nonex) 2>/dev/null
> $ echo $?
> 127
> $ 

Yes, I think so, but I don't really understand the question.
Are you asking about the following?

http://www.opengroup.org/onlinepubs/009695399/toc.htm

 2.8.2 Exit Status for Commands

...

If a command is not found, the exit status shall be 127. If the command
name is found, but it is not an executable utility, the exit status
shall be 126. Applications that invoke utilities without using the shell
should use these exit status values to report similar errors.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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