Update bash.md

Using original
```
cat file.txt | while read line; do
    echo $line
done
```
is problematic, because changing variables inside the loop are lost outside. Example:
```
count=0
cat file.txt | while read line; do
    count=$(( count+1 ))
    echo $count":"$line
done
echo "total:"$count
```
outputs to
```
total:0
```
This commit is contained in:
oheil authored and GitHub committed 2025-07-12 12:07:57 +02:00
1 parent 04f0dd3794
commit 19b09f6500
1 file changed
+2 -2
+2 -2
View File
@@ -597,9 +597,9 @@ done
### Reading lines
```bash
cat file.txt | while read line; do
while read line; do
echo $line
done
done < file.txt
```
## Bash Functions