Skip to content

Instantly share code, notes, and snippets.

@hannestyden
Created October 28, 2010 11:26
Show Gist options
  • Save hannestyden/651154 to your computer and use it in GitHub Desktop.
Save hannestyden/651154 to your computer and use it in GitHub Desktop.
Prints a random line from the bridge of Metallica's "Master of Puppets" when checking out the master branch.
#!/bin/sh
# .git/hooks/post-checkout
# chmod +x .git/hooks/post-checkout
if [ $(git symbolic-ref HEAD | cut -d '/' -f 3) == 'master' ]; then
lines[0]="Master, Master, where's the dreams that I've been after?"
lines[1]="Master, Master, you promised only lies"
lines[2]="Laughter, laughter, all I hear or see is laughter"
lines[3]="Laughter, laughter, laughing at my cries"
echo " ${lines[$((RANDOM%${#lines[*]}))]}";
fi
@asymmetric
Copy link

sed -e 's/^ //' | sed -e 's/ /-/g' can become sed -e 's/^ //' -e 's/ /-/g'

yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment