From a03fccce5d94f9bff069ed65fc32c824621ae9ad Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Wed, 9 Sep 2015 19:42:24 +0800 Subject: [PATCH] sh: update loops --- sh.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sh.md b/sh.md index d62bfd582..75a1f47c1 100644 --- a/sh.md +++ b/sh.md @@ -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 <