1 2 3 4 5 6 7 |
|
在bash脚本中,我们还可以编写类似于C语言的while循环。
1 2 3 4 5 6 7 8 |
|
使用while循环读取文件内容
while循环还提供逐行读取文件内容的选项,这是while循环在处理文件时非常有用的用法。
1 2 3 4 5 6 |
|
在这个while循环中,一次循环便从文件中读取一行,并将值存储在变量i中。
本篇文章到这里就已经全部结束了,更多其他精彩内容可以关注PHP中文网的Linux教程视频栏目!
以上就是在bash shell脚本中使用while循环的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
freeworld.posterous.com linux bash shell cheat sheet----autho:raphael
freeworld.posterous.com linux bash shell cheat sheet----autho:raphael
更多相关阅读请进入《bash》频道 >>