|
| From: | Peng Yu |
| Subject: | How to control the width of a number? |
| Date: | Tue, 4 May 2010 08:05:47 -0500 |
Hi,
I want $page has three digits. If it is less than 100, prefix it with
0. Is there an easy way to do so in bash?
for i in `seq 28 55`;
do
page=`echo '148-('$i'-28)*2'|bc`
echo $i $page
done
--
Regards,
Peng
| [Prev in Thread] | Current Thread | [Next in Thread] |