From 5e65335587fc689b781100184463f010ff53230f Mon Sep 17 00:00:00 2001 From: jtagcat Date: Sun, 22 May 2022 16:35:04 +0000 Subject: [PATCH] Add a note about grep being a placeholder; I've referenced this page for looping through pipes and files; years of my code uses this placeholder!!1 --- SC2013.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/SC2013.md b/SC2013.md index a2e585e..73c850f 100644 --- a/SC2013.md +++ b/SC2013.md @@ -39,6 +39,15 @@ done < mypipe rm mypipe ``` +NOTE: `grep -v '^ *#'` is a placeholder example and not needed. To just loop through a file: +```sh +while IFS= read -r line +do + echo "Line: $line" +done << file +# or: done <<< "$variable" +``` + ### Rationale: For loops by default (subject to `$IFS`) read word by word. Additionally, glob expansion will occur.