According to Alfred M. Szmidt on 1/19/2010 12:37 AM: > What are all the exit statuses I need to check just after expr > command? Is it only need to check 1 or 2 or 3 for fail condition > and zero for success ?else pease specify > > You only need to check for non-zero exit codes for failure.
Well, that depends on your definition of failure. POSIX specifies that expr has status 0 for successful execution where the output is non-zero and non-empty, status 1 for successful execution where the output is zero or empty, status 2 for a successful detection of an invalid expression, and any status in the range of 3-255 for failed execution. http://www.opengroup.org/onlinepubs/9699919799/utilities/expr.html Checking for hard-coded values such as 3 is non-portable, and while it may work for your particular implementation of expr, it won't necessarily carry over to other platforms. -- Don't work too hard, make some time for fun as well! Eric Blake [email protected]
signature.asc
Description: OpenPGP digital signature
