logoalt Hacker News

varenctoday at 3:51 AM1 replyview on HN

You can do:

   2>/dev/stdout
Which is about the same as `2>&1` but with a friendlier name for STDOUT. And this way `2> /dev/stdout`, with the space, also works, whereas `2> &1` doesn't which confuses many. But it's behavior isn't exactly the same and might not work in all situations.

And of course I wish you could use a friendlier name for STDERR instead of `2>`


Replies

goku12today at 7:54 AM

> You can do: > > 2>/dev/stdout

The situation where this is going to cause confusion is when you do this for multiple commands. It looks like they're all writing to a single file. Of course, that file is not an ordinary file - it's a device file. But even that isn't enough. You have to know that each command sees its own incarnation of /dev/stdout, which refers to its own fd1.