Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Did Linus Torvalds play Trick or Treat on me?
Message
De
31/10/2013 20:36:00
 
 
À
Tous
Information générale
Forum:
Windows
Catégorie:
Autre
Titre:
Did Linus Torvalds play Trick or Treat on me?
Versions des environnements
OS:
Windows Server 2012
Divers
Thread ID:
01587059
Message ID:
01587059
Vues:
76
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform