Don't use pipe to replace here-string bash executes the RHS in a subshell so will break read expressions

Philip Couling
2023-05-11 11:43:15 +01:00
parent 526fb22570
commit 9ffee9598f

@@ -178,14 +178,15 @@ done
Bash, ksh:
```Bash
grep aaa <<< "$g"
read aaa <<< $(grep foo bar)
```
POSIX:
```sh
# not exactly the same -- <<< adds a trailing \n if $g doesn't end with \n
printf '%s' "$g" | grep aaa
read << EOF
$(grep foo bar)
EOF
```
### echo flags