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, ksh:
```Bash ```Bash
grep aaa <<< "$g" read aaa <<< $(grep foo bar)
``` ```
POSIX: POSIX:
```sh ```sh
# not exactly the same -- <<< adds a trailing \n if $g doesn't end with \n read << EOF
printf '%s' "$g" | grep aaa $(grep foo bar)
EOF
``` ```
### echo flags ### echo flags