diff options
author | Levi Bostian <levi.bostian@gmail.com> | 2014-08-13 17:45:34 -0500 |
---|---|---|
committer | Levi Bostian <levi.bostian@gmail.com> | 2014-08-13 17:45:34 -0500 |
commit | 02aed42057bc38a463ef8e787ade8d3353d1e783 (patch) | |
tree | 23d0977e57e1c4f759cc2d9b2663db3d264fc7a9 /bash.html.markdown | |
parent | 17fe88764d8283f4d3676acde0b33c2680a15509 (diff) | |
parent | e1365274f7f9217a035b3e078fd7586eeef5f886 (diff) |
Merge pull request #716 from LumenTeun/master
Fixed some typos and added more for loops.
Diffstat (limited to 'bash.html.markdown')
-rw-r--r-- | bash.html.markdown | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/bash.html.markdown b/bash.html.markdown index 845ebead..061d35b0 100644 --- a/bash.html.markdown +++ b/bash.html.markdown @@ -134,14 +134,28 @@ case "$VARIABLE" in esac # for loops iterate for as many arguments given: -# The contents of var $VARIABLE is printed three times. +# The contents of $VARIABLE is printed three times. for VARIABLE in {1..3} do echo "$VARIABLE" 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 [true] +while [ true ] do echo "loop body here..." break |