Hi Victor, > > > Saying 'do_something_interesting 2>&1 > something_interesting.log' > > > > Or, the alternative action of ‘foo >bar 2>&1’. :-) > > Now to me, it's more logical to tinker with the file descriptors of > the command first and then say where they are going rather than vice > versa.
But the order is significant. :-) $ >foo $ $ ls foo missing >out 2>&1 $ cat out ls: cannot access 'missing': No such file or directory foo $ $ rm out $ ls foo missing 2>&1 >out ls: cannot access 'missing': No such file or directory $ cat out foo $ > On a related note I recall early *nixes where the command switches had > to precede all the other arguments. That's also the POSIX standard today; see getopt(3p). > Took me years to get used to the fact that in later versions you could > say 'ls foo* -l' This is a GNU extension and a bad idea. The Unix way is ‘ls -l -t foo bar xyzzy’ that matches ‘verb adverbs nouns’. It means the reader can stop on reaching the first non-option argument, knowing the rest are data rather than options. And code can do that same, e.g. getopt(). Having an unnoticed option can be the cause of awkward bugs, even dangerous ones depending on the command, and can come about through command-line editing. If that option is treating as an argument, a filename say, then that tends to have a lot less impact. -- Cheers, Ralph. -- Next meeting: BEC, Bournemouth, Tuesday, 2019-08-06 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk/ New thread, don't hijack: mailto:dorset@mailman.lug.org.uk