技术小黑屋

BashBites:Loop Through in a Directory

The trick is really easy. Just to keep record.Here we take the /tmp folder as the desired one.

1
2
3
4
5
6
#!/bin/bash 
cd /tmp
for file in `ls`
do
    echo $file
done

Others

我的博客即将搬运同步至腾讯云+社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=2t07a740wrok0


我的知乎 Live 推荐