This article was pretty comprehensive, including things like the ordering of `foo 2>&1 | bar`.<p>I would like to offer a small difference of opinion on formatting: I encourage a space after `>` and `<`, before the filename argument. I guess it's subjective, and maybe varies by person, font, syntax coloring, etc., but... I think that both helps the redirection stand out, distinguishes it descriptor duplicating syntax, and avoids reduces punctuation clumped next to each other.<p>To use one of the author's examples:<p><pre><code> cmd arg1 arg2 <myFile 3<&1 2>/dev/null >&2
cmd arg1 arg2 < myFile 3<&1 2> /dev/null >&2
cmd arg1 arg2 \
< myFile \
3<&1 \
2> /dev/null \
>&2
</code></pre>
Keep in mind that, very often, the filenames will involve variable expressions (though I couldn't say objectively whether that's an argument for or against the space):<p><pre><code> foo hello --today dog < "$InputFile" > "${OutputBase}.js"</code></pre>