Tuesday, May 6, 2008

/dev/null 2>&1

In UNIX environment, the following situation happens frequently:
script.sh > /dev/null 2>&1

What is this for?

"> /dev/null" means send standard output to the 'bit bucket" or in other words, throw it away.

"2>&1" means "redirect standard error (2) to the same place as standard output (1.)

No comments:

Post a Comment