Skip to content

Instantly share code, notes, and snippets.

@founddrama
Created February 17, 2011 03:40
Show Gist options
  • Save founddrama/830921 to your computer and use it in GitHub Desktop.
Save founddrama/830921 to your computer and use it in GitHub Desktop.
Some sample code for setting the Terminal title which didn't work; and one that did.
# did not actually work
alias mycd="cd /path/to/directory/of/interest;
osascript ~/Library/Scripts/set-terminal-tab-title.scpt
`pwd | cut -d'/' -f5`;"
-- did not actually work...
on run argv
tell application "Terminal"
set terms to every window in application "Terminal"
repeat with term in terms
if term is frontmost then
set tTabs to every tab in term
repeat with tTab in tTabs
if tTab is selected then
set cTitle to item 1 of argv
set custom title of tTab to cTitle
end if
end repeat
end if
end repeat
end tell
end run
PS1='\[\033]0;`(basename $(pwd))`\007\]\n[\t \w]\n\u@\h $ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment