Skip to content

Instantly share code, notes, and snippets.

@elchingon
Created May 3, 2015 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elchingon/c615b194a6a28481f22b to your computer and use it in GitHub Desktop.
Save elchingon/c615b194a6a28481f22b to your computer and use it in GitHub Desktop.
Bash Profile Tab Naming
function tabname {
# Will use current dir name if called without arg.
printf "\e]1;${1-$(basename `pwd`)}\a"
}
function winname {
# Will use current dir name if called without arg.
printf "\e]2;${1-$(basename `pwd`)}\a"
}
function tab {
# Will cd into current dir if called without arg.
osascript -e 'tell application "Terminal"' \
-e 'tell application "System Events" to keystroke "t" using {command down}' \
-e "do script \"cd `pwd` && cd ${1-.} && tabname && clear\" in front window" \
-e 'end tell' > /dev/null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment