diff --git a/Template.md b/Template.md index bcab03d..8491d0b 100644 --- a/Template.md +++ b/Template.md @@ -1,32 +1,20 @@ -## Add < /dev/null to prevent ssh from swallowing stdin. - -The same error applies to multiple commands, like `ffmpeg` and `mplayer`. +## (Message goes here, use `code` and *foo* wisely) ### Problematic code: ```sh -while read -r host -do - ssh "$host" "uptime" -done < hosts.txt +# Simple example of problematic code ``` ### Correct code: ```sh -while read -r host -do - ssh "$host" "uptime" < /dev/null -done < hosts.txt +# Simple example of above code, only fixed ``` ### 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`. - -The most common symptom of this is a `while read` loop only running once, even though the input contains many lines. The is because the rest of the lines are swallowed by the offending command. - -To refuse such commands input, redirect their stdin with `< /dev/null`. +(An explanation of why the code is problematic and how the correct code is an improvement) ### Exceptions: -None. \ No newline at end of file +(Cases where the user may choose to ignore this warning, if any.) \ No newline at end of file