| |
解答论坛一个朋友关于获取01、02...10,而非1、2....10。
因为需要用flashget下载这样一些列的文件。自己了解这个应用,但是以前也没有处理过。还是有需要的。经过g后,测试得到。


[root@kook tmp]# cat for.sh
for ((a=1; a<=10 ; a++))
do
       printf "%02d\n" $a
done
[root@kook tmp]# ./for.sh
01
02
03
04
05
06
07
08
09
10

这么写,也可以。

[root@kook tmp]# cat for.sh
for ((a=1; a<=10 ; a++))
do
       printf "%.2d\n" $a
done



继续测试。

[root@kook tmp]# printf "%04d\n" -3
-003
[root@kook tmp]# printf "%.4d\n" -3
-0003


本文链接:http://www.52zhe.cn/read.php/165.htm
本文作者:kook(若就博客内所涉及的技术问题交流,请用下面的MSN或Gmail联系我)
联系方式:(MSN:kook#live.com) (Google talk:kookliu)
没有版权:GNU,转载时请注明“转载人”欠本人一顿饭,来日见面之时兑现!谢谢合作!
by kook | 分类: SHELL | 评论(0) | 引用(0) | 阅读(1158)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]