shell for循环输出目录下的文件名

 

test.sh文件:
#!/bin/bash
for file in `ls`;do
        echo $file
done
输出
bogon:test macname$ chmod +x test.sh
bogon:test macname$ ./test.sh 
case
html
report
run.sh
test.sh

 

 

参考:

https://www.runoob.com/linux/linux-shell-variable.html

 

posted @ 2019-08-21 11:20  anobscureretreat  阅读(8421)  评论(0编辑  收藏  举报