mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Don't use pipe to replace here-string bash executes the RHS in a subshell so will break read expressions
@@ -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
|
||||
|
Reference in New Issue
Block a user