Bash lets you specify a redirected input before a command:$ <lines sed 's/^/line: /g'line: fooline: barBash also lets you redirect input to a compound command like a while loop:$ while read line; do echo line: $line; done <linesline: fooline: barHowever, when I try to specify a redirected input before a while loop, I get a syntax error:$ <lines while read line; do echo line: $line; donebash: syntax error near unexpected token `do'What's wrong with this? Is it not possible to specify a redirected input before a compound command in Bash? If so, why not?
Can I specify a redirected input before a compound command?
bash;shell;io redirection
man bash says:... redirection  operators  may  precede  or  appear anywhere within a simple command or may follow a command.while is not a simple command.