Miki Tebeka wrote: > Can someone explain me the difference between: > echo 1 > 1.txt 2>&1 > and > echo 1 > 1.txt 2>^&1 > > (Windows XP "cmd" shell) > > Both produce 1.txt with the content 1. > > (Sadly, I don't know how to search for ^ in google). >
The first of these joins stderr to stdout, but since there is no output to stderr has no visible effect. The second should prevent special treatment of the & character, but in this particular case actually has no effect. You can see the effects more clearly if you redirect a handle which actually does have some output: stdout redirected to stderr, but stderr still goes to console so no visible effect: C:\temp>echo hi 1>&2 hi stdout redirected to stderr, then stderr redirected to a file, but stdout still points at original stderr so no visible effect: C:\temp>echo hi 1>&2 2>x.txt hi stderr redirected to a file, then stdout redirected to same file. Output goes in a file: C:\temp>echo hi 2>x.txt 1>&2 C:\temp>type x.txt hi Same as above. Using ^ to avoid special interpretation of the & has no effect: C:\temp>echo hi 2>x.txt 1>^&2 C:\temp>type x.txt hi -- http://mail.python.org/mailman/listinfo/python-list