From 9c9b487f40e2c95dee2cbf6ffe601eadf8fe7f6c Mon Sep 17 00:00:00 2001 From: Victor Engmark Date: Thu, 25 Jun 2020 15:28:28 +1200 Subject: [PATCH] Updated SC2095 (markdown) --- SC2095.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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`.