Skip to content

Instantly share code, notes, and snippets.

@damienklinnert
Forked from tj/some.sh
Created January 15, 2013 19:13
Show Gist options
  • Save damienklinnert/4541148 to your computer and use it in GitHub Desktop.
Save damienklinnert/4541148 to your computer and use it in GitHub Desktop.
function tabname {
printf "\e]1;$1\a"
}
if [ x`type -t cd` == "xfunction" ]; then
# previously wrapped cd
eval $(type cd | grep -v 'cd is a function' | sed 's/^cd/original_cd/' | sed 's/^}/;}/' )
else
# builtin
eval "original_cd() { builtin cd \$*; }"
fi
cd() {
original_cd "$*"
tabname $(basename $(pwd))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment