bug-coreutils
[Top][All Lists]
Advanced

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

Re: Bug in expr***urgent


From: Eric Blake
Subject: Re: Bug in expr***urgent
Date: Sat, 16 Jan 2010 07:03: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/16/2010 6:38 AM:
> Hi,
>  
> thank you for the patiance ..I am sorry for being top posted.
> The piece of script is to check alphanumeric
>  
> BH(batch header) for the file having issue is
> BH|660|FILE1|2009/12/30|28|28|19.80||878.000|
> IS|123|456|
> FILE2
> BH|660|FILE2|2009/12/30|1|1|19.80||878.000|
>  
> Piece of Script
> ------------------------
>  isnum=`awk -F$delim '$1=="BH"{print $5}' $fil`  
> # HERE 5 THE FIELD FILE1 IS sum of records =28
>         #awk -F$delim '$1=="BH"{print $5}' $fil |read isnum
>  log_msg "Debug msg1 File $fil has isnum $isnum"
>         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"
>         add_num=`expr $int_num + 1 1>/dev/null 2>&1`
>  if [ "$?" -ne "0" ] then
>          
>          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`
>   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
>  continue for next check
> Note:This issue happens only very rate bu this also need to be eliminated.
> I am able to simulate it once .Please find the below debug  output
> Debug msg1 File FILE1 has isnum 28 and pstat 0
> Debug msg2 File FILE1 has isnum 28
> Debug msg3 File FILE1 has int_num 28 has ps 0
> Debug msg3.1 File FILE1 has int_num1 28 has ps 0
> Debug msg4.new1 File has expr pstat 51198 int_num is 28

You aren't helping us help you.  There is nothing that says new1 in the
script you posted above.  Until you post EXACTLY what you ran, and EXACTLY
what it produced, there's no way we can tell you why your message that
includes the text new1 is printing the value 51198.

> 1. is it becuase of expr command is not stable in linux and need to
> upgrade or use other commands like case as you given?The same script is
> working without any issue in unix

expr is more or less stable, but it is ALWAYS a good idea to report bugs
against the latest version (if indeed it is a bug in expr).  But more
likely, the bug is in your script, and not 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]