[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: expr exit status
From: |
salih k |
Subject: |
Re: expr exit status |
Date: |
Wed, 20 Jan 2010 20:55:29 +0800 |
On Wed, Jan 20, 2010 at 8:29 PM, Philip Rowlands <address@hidden> wrote:
> On Wed, 20 Jan 2010, salih k wrote:
>
> Now shall I explain again (sorry:))
>>
>> actually the issue is rare and never happened in unix .So am curious on
>> this.
>>
>
> "never happened in unix"? Which OS and shell are you using?
>
> Now my query is why these exit status (254 or 16) are coming during the
>> first run then it become correct value after rerun?and
>>
>> *what does it mean by exit status 16 and 254?Whether this can do any thing
>> with expr or issue with *
>> */dev/null etc?*
>>
>
> No it can't. The exit status you observe is a bug or a mistake in your code
> or analysis.
>
>
> Thats why am asking *whether I can use if [ $? -eq 1 -o $? -eq 2 -o $? -eq
>> 3 ]
>> instead of*
>>
>> *if [ $? -ne 0 ].
>>
>
> No; the apparent exit status greater than 255 is a bug, or a mistake in
> your code or analysis.
>
>
> If i should not use if [ $? -eq 1 -o $? -eq 2 -o $? -eq 3 ] then i will go
>> ahead with case.But the current expr is a running codew so my manager need
>> explanation.thats why.If expr is not stable i have to change all the
>> places
>> in script which uses expr.
>>
>
> If it's important to explain your observed usage of expr then I'm not sure
> what to suggest; maybe run the whole script under strace and check what
> arguments for exit() expr is giving, which may hint at the cause of the
> problem.
>
>
> Cheers,
> Phil
>
----
Hi,
Well ,I have three queries now,
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(?)
2.The exit status you observe is a bug or a mistake in your code or
analysis I did not get.
Ans-see below log trace
* Debug msg1 File 1 has isnum 28 and pstat 0
Debug msg2 File 1 has isnum 28
Debug msg3 File 1 has int_num 28 has ps 0
Debug msg3.1 File 1 has int_num1 28 has ps 0
Debug msg4.new1 File has expr pstat 51198 int_num is 28
Debug msg4 File 1 with paddnum has expr pstat 0
Debug msg5 File 1 with paddnum1 29 pstat1 0
File 1 has alpha-numeric value in header record for total shipments !!!
aborting
Upload of file 1 aborting
------------------------------------------------
DATE: 07/01/2010 TIME: 21:27:59
-----------------------------------------------------*
*...
Debug msg2 File 2 has isnum 1
Debug msg3 File 2 has int_num 1 has ps 0
Debug msg3.1 File 2 has int_num1 1 has ps 0
Debug msg4.new1 File has expr pstat 1552 int_num is 1--->3!!!
Debug msg4 File 2 with paddnum has expr pstat 0---inside the if condition i
gave the same expr smt result now zero!!!*
*This is am asking about stability!!!*
This means that status is >3 outside(even if the argument to expr is 28 or
1) the if condition then it became zero inside!!!
see the below script for the trace
* **isnum=`awk -F$delim '$1=="BH"{print $5}' $fil`*
* #awk -F$delim '$1=="BH"{print $5}' $fil |read isnum*
* log_msg "Debug msg1 File $fil has isnum $isnum and pstat $?" *
* isnum=${isnum:-0}*
* log_msg "Debug msg2 File $fil has isnum $isnum" *
* int_num=`echo -e $isnum | cut -f1 -d'.'`*
* log_msg "Debug msg3 File $fil has int_num $int_num has ps $?" *
* int_num1=`echo $isnum | cut -f1 -d'.'`*
* log_msg "Debug msg3.1 File $fil has int_num1 $int_num1 has ps $?"*
* add_num=`expr $int_num + 1 1>/dev/null 2>&1`*
* kms=$?*
* if [ "$kms" -ne "0" ]*
*then*
* log_msg "Debug msg4.new1 File has expr pstat $kms int_num is
$int_num"*
* padd_num=`expr $int_num + 1 1>/dev/null 2>&1`*
* log_msg "Debug msg4 File $fil with paddnum has expr pstat $?" *
* padd_num1=`expr $int_num + 1 2>/dev/null`*
* log_msg "Debug msg5 File $fil with paddnum1 $padd_num1 pstat1 $?"*
* errmsg "File `basename $fil` has alpha-numeric value in
header record for total shipments !!! aborting"*
* sleep 1*
* log_msg "Upload of $fil aborting"*
* log_msg "------------------------------------------------"*
* out_rep $repfil "\nFile `basename $fil` has alpha-numeric
value in header record for total shipments !!! aborting"*
* continue*
* fi*
**
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
Thanks,
Salih
- 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 <=
- 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