so I'm trying to build one of my first scripts, but it doesn't execute correctly.
I would like to git fetch --prune origin
inside the script, but before that, I would like to ask the question, would you like to "continue" or "exit". The "exit" part works, but not the "continue" part.
#!/usr/bin/env bash
echo "Ready to git-some and sync your local branches to the remote counterparts ?"
REPLY= read -r -p 'Continue? (type "c" to continue), or Exit? (type "e" to exit): '
if [[ "${REPLY}" == 'c ' ]]
then
echo "About to fetch"
git fetch --prune origin
elif [[ "${REPLY}" == 'e' ]]
then
echo "Stopping the script"
fi
Stopping the script
, or does it just silently exit? What happens if you type a letter other than “c” or “e”? What debugging have you done? (Hint: printing variables is a good idea 107% of the time.) – G-Man Says 'Reinstate Monica' Sep 05 '18 at 06:32print MY_VAR_NAME
thanks for that :) – intercoder Sep 05 '18 at 07:17