Skip to content

Instantly share code, notes, and snippets.

@wesen
Created February 24, 2013 16:25
Show Gist options
  • Select an option

  • Save wesen/5024421 to your computer and use it in GitHub Desktop.

Select an option

Save wesen/5024421 to your computer and use it in GitHub Desktop.
make a release name
#!/bin/bash
hextodec() {
until [ -z "$1" ]
do
i=`echo "$1" | tr '[:lower:]' '[:upper:]'`
echo "obase=10;ibase=16;$i" | bc
shift
done
}
lowerwords () {
cat /usr/share/dict/words | grep -e '^.\{1,8\}$' | tr [:upper:] [:lower:]
}
LOWERWORDS=``
GITREV=$(hextodec $(git rev-parse --short=8 HEAD))
FIRST=$(echo $GITREV | cut -c 1-4)
LAST=$(echo $GITREV | cut -c 5-8)
FIRSTNAME=$(lowerwords | tail -n $FIRST | head -n1)
LASTNAME=$(lowerwords | tail -n $LAST | head -n1)
echo $FIRSTNAME-$LASTNAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment