Added two new ways to use for loops.

This commit is contained in:
LumenTeun 2014-08-08 18:24:43 +01:00
parent 4320966262
commit e1365274f7

View File

@ -140,6 +140,20 @@ do
echo "$VARIABLE" echo "$VARIABLE"
done done
# They can also be used to act on files..
# This will run the command 'cat' on file1 and file2
for VARIABLE in file1 file2
do
cat "$VARIABLE"
done
# ..or the output from a command
# This will cat the output from ls.
for OUTPUT in $(ls)
do
cat "$OUTPUT"
done
# while loop: # while loop:
while [ true ] while [ true ]
do do