mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-08 15:56:47 +02:00
Add traditional for loop bash example to close https://github.com/adambard/learnxinyminutes-docs/pull/654
This commit is contained in:
@@ -8,6 +8,7 @@ contributors:
|
|||||||
- ["Denis Arh", "https://github.com/darh"]
|
- ["Denis Arh", "https://github.com/darh"]
|
||||||
- ["akirahirose", "https://twitter.com/akirahirose"]
|
- ["akirahirose", "https://twitter.com/akirahirose"]
|
||||||
- ["Anton Strömkvist", "http://lutic.org/"]
|
- ["Anton Strömkvist", "http://lutic.org/"]
|
||||||
|
- ["Rahil Momin", "https://github.com/iamrahil"]
|
||||||
filename: LearnBash.sh
|
filename: LearnBash.sh
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -140,6 +141,12 @@ do
|
|||||||
echo "$VARIABLE"
|
echo "$VARIABLE"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Or write it the "traditional for loop" way:
|
||||||
|
for ((a=1; a <= 3; a++))
|
||||||
|
do
|
||||||
|
echo $a
|
||||||
|
done
|
||||||
|
|
||||||
# They can also be used to act on files..
|
# They can also be used to act on files..
|
||||||
# This will run the command 'cat' on file1 and file2
|
# This will run the command 'cat' on file1 and file2
|
||||||
for VARIABLE in file1 file2
|
for VARIABLE in file1 file2
|
||||||
|
Reference in New Issue
Block a user