tags:

views:

94

answers:

2

To redirect stderr to stdout we use 2 > &1. Why is it not just 2 > 1? why & is needed?

+7  A: 

because your stream would be redirected to file named "1"

Pierre
chappar
because 2 in that case is not ambiguous
Benny Wong
+3  A: 

Because 2>1 would redirect to a file named "1". The & symbol specifies a stream rather than a file. The & symbol is not necessary for the 2 because the 2 is always a stream inidcator

Randolpho