kkmuffme
2025-01-13 02:19:01 +01:00
parent bafdc6fd42
commit 7cdb5fd5e2

@@ -12,7 +12,7 @@ done
### Correct code:
```sh
grep -v '^ *#' < file | while IFS= read -r line
grep -v '^ *#' file | while IFS= read -r line
do
echo "Line: $line"
done
@@ -24,14 +24,14 @@ or without a subshell (bash, zsh, ksh):
while IFS= read -r line
do
echo "Line: $line"
done < <(grep -v '^ *#' < file)
done < <(grep -v '^ *#' file)
```
or without a subshell, with a pipe (more portable, but write a file on the filesystem):
```sh
mkfifo mypipe
grep -v '^ *#' < file > mypipe &
grep -v '^ *#' file > mypipe &
while IFS= read -r line
do
echo "Line: $line"