sh: update loops

This commit is contained in:
Rico Sta. Cruz 2015-09-09 19:42:24 +08:00
parent e6dfae26fc
commit a03fccce5d
1 changed files with 10 additions and 4 deletions

14
sh.md
View File

@ -53,6 +53,12 @@ Loops
echo "Welcome $i"
done
### Reading lines
cat file.txt | while read line; do
echo $line
done
Functions
---------
@ -250,11 +256,11 @@ or
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do; case $1 in
esac; shift; done
### Reading
### Heredoc
cat x | while read line; do
echo $line
done
cat <<END
hello world
END
## Reference