Berkeley CSUA MOTD:Entry 32614
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/24 [General] UID:1000 Activity:popular
5/24    

2004/8/1-2 [Computer/SW/Languages/Misc] UID:32614 Activity:high
8/1     A silly question: how do I output something to stderr from a shell
        script, except by echo foo-bar > /dev/fd/3?
        \_ You mean /dev/fd/2, right?  That works fine, and it's actually
           the only way to do it in csh.  If you're using sh, you can also
           do "echo foo-bar >&2" -- the &2 means "file descriptor 2", just
           like /dev/fd/2.
           \_ Stricly speaking you want echo foo 1>&2 in sh.