sh: update loops
This commit is contained in:
parent
e6dfae26fc
commit
a03fccce5d
14
sh.md
14
sh.md
|
@ -53,6 +53,12 @@ Loops
|
||||||
echo "Welcome $i"
|
echo "Welcome $i"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
### Reading lines
|
||||||
|
|
||||||
|
cat file.txt | while read line; do
|
||||||
|
echo $line
|
||||||
|
done
|
||||||
|
|
||||||
Functions
|
Functions
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
@ -250,11 +256,11 @@ or
|
||||||
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do; case $1 in
|
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do; case $1 in
|
||||||
esac; shift; done
|
esac; shift; done
|
||||||
|
|
||||||
### Reading
|
### Heredoc
|
||||||
|
|
||||||
cat x | while read line; do
|
cat <<END
|
||||||
echo $line
|
hello world
|
||||||
done
|
END
|
||||||
|
|
||||||
## Reference
|
## Reference
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue