I am trying to convert the following script from BASH to ZSH and the POPD just won't work... Could someone help me please?
runMyScript() {
if [[ -e $PROJECTS_HOME/myFolder/myScript.sh]]; then
pushd $PROJECTS_HOME/myFolder > dev/null
. ./myScript.sh
popd > dev/null
else
... //Do something else instead
fi
}
runMyScript
The error is this
myScript:popd:5: directory stack empty
Now I know what this means, but I don't seem to be able to fix it... I am also struggling to find a meaningful fix as well.
If I run the script manually, it seems to work fine, but if I run it by calling runMyScript that's when it seems to fail.
Could someone help me out please?
I altered the script based on some feedback from @shellter and the script now seems to be working... the new code looks like this;