Sed in Script problem using expr
Miner, Jonathan W (CSC) (US SSA)
jonathan.w.miner at baesystems.com
Tue Nov 14 13:16:21 UTC 2006
-----Original Message-----
From: fedora-list-bounces at redhat.com 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}'`
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 2725 bytes
Desc: not available
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20061114/915190eb/attachment-0002.bin
More information about the users
mailing list