[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: expr exit status
From: |
Eric Blake |
Subject: |
Re: expr exit status |
Date: |
Tue, 19 Jan 2010 06:14:09 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
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 address@hidden
signature.asc
Description: OpenPGP digital signature
- expr exit status, salih k, 2010/01/19
- expr exit status, salih k, 2010/01/20
- Re: expr exit status, Philip Rowlands, 2010/01/20
- Re: expr exit status, salih k, 2010/01/20
- Re: expr exit status, Philip Rowlands, 2010/01/20
- Re: expr exit status, salih k, 2010/01/20
- Re: expr exit status, Eric Blake, 2010/01/20
- Re: expr exit status, Eric Blake, 2010/01/20
- Re: expr exit status, salih k, 2010/01/20