Ich versuche Pythonbrew von einem Bash-Skript zu deaktivieren. In der Shell funktioniert die Eingabe pythonbrew off
korrekt.
In meinem Bash-Skript pythonbrew off
wird einfach ignoriert. wenn echo ich:Deaktivieren von Pythonbrew aus einem Bash-Skript
[email protected]:~/Projects/devenv$ echo $("pythonbrew off")
pythonbrew off: command not found
Funktion aufrufen, wird das Programm, ohne das Drucken der Fehlermeldung zu beenden.
Hier ist die Funktion:
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
}