Skip to content

Instantly share code, notes, and snippets.

@squeeks
Created May 13, 2011 16:12
Show Gist options
  • Save squeeks/970817 to your computer and use it in GitHub Desktop.
Save squeeks/970817 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# "Go away or I will replace you with a very small shell script"
#
# $ curl -sL http://bit.ly/mSEVHs | sh
# $ tag "IRC"
if [ `/usr/bin/uname` != 'Darwin' ]; then
echo "There's no point running this - OS X is required";
exit 1;
elif [ $TERM_PROGRAM != 'Apple_Terminal' ]; then
echo "There's no point running this - Terminal.app is required";
exit 1;
fi
if [ $SHELL == '/bin/bash' ]; then
if [ ! -f ~./bash_profile ]; then
/usr/bin/touch ~/.bash_profile;
fi
echo 'function tag() { echo -ne "\\033]0;$@\\007"; }' >> ~/.bash_profile;
source ~/.bash_profile;
elif [ $SHELL == '/bin/zsh' ]; then
if [ ! -f ~./bash_profile ]; then
/usr/bin/touch ~/.zshrc;
fi
echo 'tag() { echo -n "\\033]0;$@\\007"; }' >> ~/.zshrc;
source ~/.zshrc;
elif [ $SHELL == '/bin/ksh' ] || [$SHELL == '/bin/sh']; then
if [ ! -f ~./bash_profile ]; then
/usr/bin/touch ~/.profile;
fi
echo 'tag() { /bin/echo -n "\\033]0;$@\\007"; }' >> ~/.profile;
source ~/.profile;
elif [ $SHELL == '/bin/csh' ] || [$SHELL == '/bin/tcsh']; then
echo "I really can't get this to play with csh/tcsh, patches welcome";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment