Reputation: 81
I want to redirect the stderr and stdout to dev/null. Which ist the correct way to redirect and is there difference betweent these options? I have seen in internet two syntax:
command &>/dev/null
(without space)
command &> /dev/null
(with space)
Thanks in advance!
Upvotes: 3
Views: 600
Reputation: 149991
Bash allows spaces around a redirection operator, so both forms are valid.
That said, you can't use spaces between parts of more complex redirection operators, e.g:
command 2> /dev/null # ok
command 2 > /dev/null # wrong, the operator is '2>'
command 2> &1 # wrong, the operator is '2>&1'
Upvotes: 3