Sono molto pessimo con lo script di shell (con bash), sto cercando un modo per controllare se il ramo git corrente è "x", e abortire script se non è "x".bash script per verificare se il corrente git branch = "x"
#!/usr/bin/env bash
CURRENT_BRANCH="$(git branch)"
if [[ "$CURRENT_BRANCH" -ne "master" ]]; then
echo "Aborting script because you are not on the master branch."
return; # I need to abort here!
fi
echo "foo"
, ma questo non è giusto
Dato che il codice è sintatticamente non valido, [shellcheck. net] (http://shellcheck.net) dovrebbe essere il tuo primo ricorso. – mklement0