mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2095 (markdown)
12
SC2095.md
12
SC2095.md
@@ -19,6 +19,18 @@ do
|
|||||||
ssh -n "$host" "uptime"
|
ssh -n "$host" "uptime"
|
||||||
done < hosts.txt
|
done < hosts.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```sh
|
||||||
|
while read -r host
|
||||||
|
do
|
||||||
|
ssh "$host" <<'EOF'
|
||||||
|
uptime
|
||||||
|
EOF
|
||||||
|
done < hosts.txt
|
||||||
|
```
|
||||||
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
|
||||||
Commands that process stdin will compete with the `read` statement for input. This is especially tricky for commands you wouldn't expect reads from stdin, like `ssh .. uptime`, `ffmpeg` and `mplayer`.
|
Commands that process stdin will compete with the `read` statement for input. This is especially tricky for commands you wouldn't expect reads from stdin, like `ssh .. uptime`, `ffmpeg` and `mplayer`.
|
||||||
|
Reference in New Issue
Block a user