<> == I'm reading a file line by line and running ssh or ffmpeg, only the first line gets processed! == When [[BashFAQ/001|reading a file line by line]], if a command inside the loop also reads stdin, it can exhaust the input file. For example: {{{#!highlight bash # Non-working example while IFS= read -r file; do ffmpeg -i "$file" -c:v libx264 -c:a aac "${file%.avi}".mkv done < <(find . -name '*.avi') }}} {{{#!highlight bash # Non-working example while read host; do ssh "$host" some command done < hostslist }}} What's happening here? Let's take the first example. `read` reads a line from standard input (FD 0), puts it in the file parameter, and then `ffmpeg` is executed. Like any program you execute from BASH, `ffmpeg` inherits standard input. However, `ffmpeg` additionally uses standard input to detect quit commands indicated by user input of `q`, thus sucking up all the input from the `find` command and starving the loop. Use the `-nostdin` global option in `ffmpeg` to disable interaction on standard input: {{{#!highlight bash while IFS= read -r file; do ffmpeg -nostdin -i "$file" -c:v libx264 -c:a aac "${file%.avi}".mkv done < <(find . -name '*.avi') }}} Alternatively you could use [[BashGuide/InputAndOutput#Redirection|redirection]] at the end of the ffmpeg line: `