2>&1

Ferdinand Haselbacher (jr.) axp at shacknet.at
Sun May 28 13:46:48 PDT 2006


On Sun, May 28, 2006 at 09:14:43AM -0400, Mike Jeays wrote:
> On Sun, 2006-05-28 at 08:46 -0400, Grant Peel wrote:
> > Hi all,
> > 
> > When using cron, I understand the >/dev/null thing OK, but what exactly does 
> >  >2&1 do? Is it usefull anywhere else? Where might one find ducumentation on 
> > it?
> > 
> > -Grant
> > 
> > 
> > _______________________________________________
> > freebsd-questions at freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
> 
> It directs both stdout and stderr to /dev/null.  Look in 'man bash', or
> any tutorial on bash for a more detailed description.  Quite confusing
> syntax, and a hard-to-remember incantation, IMHO.
the trick of the "&" is that the fd (filediscriptor) is kept open and if you
redirect fd 1 to a file and fd 2 to file it would get overwritten!

one last word to Bash: bash seems to be nice, it is indeed, but for real
good and compatible scripting i would recommend you to use plain sh.

so far,
Ferdinand Haselbacher


More information about the freebsd-questions mailing list