I would like to have a bash script that will recognize if the caller is not on a git tag (but on an un tagged branch e.g.). I tried the following:
OUTPUT=$(git describe --exact-match --tags $(git log -n1 --pretty='%h')|grep "fatal:")
if [[ $OUTPUT != "0" ]]; then
echo "no tag present"
fi
but I get no tag present even if there clearly is a tag and the print out of git describe --exact-match --tags $(git log -n1 --pretty='%h') does not contain fatal:. Why does this not work as expected?