1>/dev/null and >/dev/null and &>/dev/null

Viewed 388
i=5
expr $i + 6 1>/dev/null

Redirect stdout to /dev/null. How about

expr $i + 6 >/dev/null

What is the difference between expr $i + 6 1>/dev/null and expr $i + 6 >/dev/null?

Someone writes

expr $i + 6 &>/dev/null

And what does it mean?

1 Answers

command >/dev/null is a shorthand for command 1>/dev/null, it redirects stdout to /dev/null.

command &>/dev/null is a shorthand for command 1>/dev/null 2>&1, it redirects both stdout and stderr to /dev/null.

Related