I\'m trying to write a short script to log certain environment variables of my current shell session to file. Unfortunately the output of \"python --version\" seems to ignor
a simpler solution is:
python --version 2>> path.log
python --version
outputs to STDERR
.
You need to merge STDERR
into STDOUT
:
python --version >> path.log 2>&1
For reference, you can verify such behavior by saying:
$ python --version 1>/dev/null
Python 2.7.4
The STDOUT
in the above example was redirected to /dev/null
. This would imply that the output is being sent to STDERR
.