0
我試圖從bash腳本中取消激活pythonbrew。 當在shell中輸入pythonbrew off
可以正常工作。
在我的bash腳本pythonbrew off
只是被忽略。 使用迴音時,我得到:從bash腳本中取消激活pythonbrew
[email protected]:~/Projects/devenv$ echo $("pythonbrew off")
pythonbrew off: command not found
調用函數使程序不打印失敗消息退出。
這裏的功能:
function deactivate_pythonbrew()
{
echo "Detecting whether Pythonbrew is installed."
pythonbrew_version="$(pythonbrew --version 2>&1)"
if [ -n $pythonbrew_version ]
then
echo "Pythonbrew $pythonbrew_version found."
if [ -n $pythonbrew ]
then
pythonbrew off || echo "Failed to deactivate pythonbrew. Aborting." && exit $?
else
echo "Pythonbrew is inactive. Skipping."
fi
else
echo "Pythonbrew is not installed. Skipping."
fi
}