bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

expr exit status


From: salih k
Subject: expr exit status
Date: Wed, 20 Jan 2010 18:06:16 +0800

Hi,
add_num=`expr $int_num + 1 1>/dev/null 2>&1`

        if [ "$?" -ne "0" ]

some case exit status is 1552 for expr even though the argument is integer
.Initialy i checked
if [ $?-ne 0 ],but this shows the above error so, i am planning to use
kms=$?
if [ $kms -eq 1 -o $kms -eq 2 -o $kms -eq 3 ]
instaed of
if [ "$kms" -ne "0" ] *is it fine or will it make issues.
* The mannual says
info expr|more
    Exit status:
      0 if the expression is neither null nor 0,
      1 if the expression is null or 0,
      2 if the expression is syntactically invalid,
      3 if an error occurred.
Regards,
Salih


reply via email to

[Prev in Thread] Current Thread [Next in Thread]