mirror of
https://github.com/sahinakkaya/til.git
synced 2025-07-11 05:39:41 +03:00
TIL: Looping through the files
This commit is contained in:
13
bash-scripting/looping-through-the-files.md
Normal file
13
bash-scripting/looping-through-the-files.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
You can loop through the files with:
|
||||||
|
```
|
||||||
|
for f in * ; do
|
||||||
|
echo $f
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to loop through only directories:
|
||||||
|
```
|
||||||
|
for d in */ ; do
|
||||||
|
echo $d
|
||||||
|
done
|
||||||
|
```
|
Reference in New Issue
Block a user