RE: Sed in Script problem using expr

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

 





-----Original Message-----
From:	fedora-list-bounces@xxxxxxxxxx on behalf of Paul Ward
Sent:	Tue 11/14/2006 06:14 AM
To:	For users of Fedora Core releases
Cc:	
Subject:	Sed in Script problem using expr

Hi All,

Can anyone help me with the following script problem please its driving me nuts.

myscript.sh:

NUM=`expr $i - 2`; printf %02d $NUM ; echo " "

-------------------------------

You need to save the output from the printf command:

NUM=`expr $1 - 2`
NUM=`printf %02d $NUM`

or, a one liner

NUM=`echo $i | awk '{printf "%02d", $1 - 2}'`

<<winmail.dat>>


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux