私はシェルスクリプト(bashで)が非常に悪いので、現在のgitブランチが "x"であるかどうかを確認する方法を探しています( ) "x"でなければスクリプト。現在のgitブランチが "x"であるかどうかをチェックするbashスクリプト
#!/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"
が、これはかなり右
あなたのコードは構文的に無効ですので、[shellcheck。 net](http://shellcheck.net)が最初の手段です。 – mklement0