diff --git a/SC2095.md b/SC2095.md index 51a9444..d94fee6 100644 --- a/SC2095.md +++ b/SC2095.md @@ -19,6 +19,18 @@ do ssh -n "$host" "uptime" done < hosts.txt ``` + +or + +```sh +while read -r host +do + ssh "$host" <<'EOF' +uptime +EOF +done < hosts.txt +``` + ### 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`.