Skip to content

Instantly share code, notes, and snippets.

@chitacan
Forked from tj/some.sh
Created October 26, 2012 04:54
Show Gist options
  • Save chitacan/3956872 to your computer and use it in GitHub Desktop.
Save chitacan/3956872 to your computer and use it in GitHub Desktop.
sh: change terminal tab name on cd
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))
}
@chitacan
Copy link
Author

  • cd 명령어를 통해 이동하는 디렉토리에 space가 있을 경우, cd가 제대로 동작하지 않음

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