I always write stdin redirection after the command, because for me it's more natural to have first the command and then the redirections (if any):some-command < input-file > output-fileFor years, I've seen people writing the stdin redirection before the command, to have some flow direction:< input-file some-command > output-file (or without spaces after < and > )Is this ordering accepted by POSIX or just accepted by many shells (in my fedora 21 it is accepted by bash, dash, tcsh, ksh and zsh)?
posix placement of stdin redirection (
shell;io redirection;posix
That behavior was defined by POSIX here:If more than one redirection operator is specified with a command, the  order of evaluation is from beginning to end.and here:A simple command is a sequence of optional variable assignments and  redirections, in any sequence, optionally followed by words and  redirections, terminated by a control operator.This was already the case in the Bourne shell, which POSIX used as a basis.Before a command is executed its input  and  output  may  be       redirected  using  a  special  notation  interpreted  by the       shell.  The following  may  appear  anywhere  in  a  simple-       command  or  may  precede  or  follow  a command and are not       passed on  to  the  invoked  command. ()Unlike the original Bourne shell, POSIX doesn't allow redirection to precede a complex command like while done, (  ), etc.A note that the order of redirection is important, because it control your command behavior and prevent you from some weird result upon failure. Example:command <input >outputif command failed to read input (due to permission, non-existed ...) then it will be terminated without create empty file output if you swap the redirection position:command >output <input