1 2 3 4 5 6 7 8 9 10 11
#!/bin/sh if [ -d .git ]; then VERSION="`cat .git/HEAD`" case $VERSION in ref:*) ref="${VERSION#ref: }"; VERSION="`cat .git/$ref`";; *) ;; esac fi echo ${VERSION:-no git}