Objective: to get python version in shell script
Observation:
[root@srvr0 ~]# python --version
Python 2.7.5
Code:
export python_version=`python --version`
echo "\$python_version=$python_version"
Expected:
$python_version=Python 2.7.5
Actual:
$python_version=
Please help me getting python version in shell script.
pythonand, e.g.python2. If you have a need for one or the other, it's worth checking how your distribution handles the naming.