bug-coreutils
[Top][All Lists]
Advanced

[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: Wed, 20 Jan 2010 06:01:46 -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 salih k on 1/20/2010 5:55 AM:
>           Hi,
>          Well ,I have three queries now,

[please trim your replies down to relevant portions you are replying to -
we don't need to read the same text over and over again]

> 
>           1.I am waiting for  answer whether I can use if [ $? -eq 1 -o $?
> -eq 2 -o $? -eq 3 ]!!! as only these values are meaningful if we
>           are checking for alphanumic cases(?)

NO.  We have REPEATEDLY told you that checking $? -eq 3 is NOT a portable
way to check for failure.  GNU coreutils' expr can fail with a status >
128 if it was terminated by a signal.  Therefore, checking merely against
status 3 is insufficient to catch the case of all possible statuses larger
than 2.

> Debug msg4.new1 File has expr pstat 51198 int_num is 28

And you've already posted that, but without any strace proof that your
system or shell is not the culprit.

> 3.As you suggested(thanks)"check what arguments for exit() expr is giving"
> 
> =Frankly i dont know how to check the same I will be thankful if you please
> let me know the way to check the same

If you are on a Linux system, then 'strace expr $int_num + 1' will give
you a (very verbose) dump of every system call, including which value
exit() was called with.  In all likelihood, it will have been exit(0), in
which case, if $? is corrupted, it is a bug in your shell and not in expr.

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

Eric Blake             address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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