It would be nice if this was tagged in perlrun somewhere, but it probably the default expectation for unix tools and so doesn't rate a mention.
It isn't. The default for most unix utilities is to just exit with
1 (or 255 for a few)[1].
Test exits with 1 for false condition and 2 for an error.
A few programs give a detailed error code depending on the error.
I however have never seen any (other than Perl)
that would use the ERRNO code as a return value.
Ruby exits with 1 no matter what.
Update: I have $? printed in my bash prompt, that's how I know.
[1]: I'm not sure in that.
Update: The glibc manual says
... it does not work to use the value of `errno' as the exit status--these can exceed 255.This is not yet actual as the errno codes are less than 126 in my system, but there might be much more in later systems. (There are 252 syscalls in linux, they will soon exceed one byte. Lucky the number is stored in %eax so we can have up to 4G syscalls and 2G errno values:)
In reply to Re^4: ActivePerl exit codes
by ambrus
in thread ActivePerl exit codes
by qadwjoh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |