Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Did Linus Torvalds play Trick or Treat on me?
Message
From
31/10/2013 20:36:00
 
 
To
All
General information
Forum:
Windows
Category:
Other
Title:
Did Linus Torvalds play Trick or Treat on me?
Environment versions
OS:
Windows Server 2012
Miscellaneous
Thread ID:
01587059
Message ID:
01587059
Views:
77
I was surprised to find out that I could not always capture the output of a command to a file. Some examples:
git add -h > temp.txt          && output captured in file temp.txt
git add > temp.txt             && output NOT captured in file temp.txt
git branch -h > temp.txt       && output NOT captured in file temp.txt
git branch > temp.txt          && output captured in file temp.txt
Searching on the internet I found out that commands have at least two different output streams, STDOUT and STDERR
Also found that with a special command redirection format you can capture both STDOUT and STDERR to a file:
git add > temp.txt 2>&1        && output IS captured in file temp.txt because command output is an error message in STDERR
However, in the case of "git branch -h", GIT sends its output to STDERR, even though it should go to STDOUT !
Did Linus Torvalds (author of GIT) play Trick or Treat on me on this Halloween day?
git branch -h > temp.txt 2>&1  && output IS captured in file temp.txt
Alex
Next
Reply
Map
View

Click here to load this message in the networking platform