According to salih k on 1/10/2010 10:50 PM:
> Hi,
> There is a bug iin the expr command and exit status is"51198" some times
> "1552"

Exit status can never exceed 255 - per POSIX, it is strictly capped at 8
bits to all observers.  I'm not sure where you are getting those numbers.

> I have used expr to check whether the variable is numeric
>        add_num=`expr $int_num + 1 1>/dev/null 2>&1`
>  kms=$?
>        # if [ "$?" -ne "0" ]
>          if [ "$kms" -ne "0" ]
>         then
> here $kms returns exit status other than zero even if $int_num is numeric

That is not a bug.  POSIX requires that expr give an exit status of 1 if
$int_num is the value 0.  Perhaps you want to try:

if [ "$kms" -gt 1 ]

to detect syntactically invalid expressions or command-line errors.

-- 
Don't work too hard, make some time for fun as well!

Eric Blake             [email protected]

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to