Skip to content

Instantly share code, notes, and snippets.

@entaroadun
Created January 8, 2012 18:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save entaroadun/1579312 to your computer and use it in GitHub Desktop.
Save entaroadun/1579312 to your computer and use it in GitHub Desktop.
Setting Mac OS X Terminal title in bash
## #####################
## ## Setting Mac OS X
## ## Terminal.app name.
## ## This code goes to
## ## all your ~/.bashrc or
## ## ~/.bash_profile files.
## ## Now you can jump from
## ## machine to machine and
## ## never get lost.
## #####################
## -----------------------------
## -- this runs when you get new
## -- you get new interactive bash
## -- shell - the condition is needed
## -- so it will not interrupt the scp command
if [[ "$-" =~ "i" ]]; then
echo -n -e "\033]0;${USER}@${HOSTNAME%%.*}\007";
fi;
## -----------------------------
## -- this runs when you logoff
## -- from a ssh session - it puts
## -- back previous terminal name;
function ssh() {
/usr/bin/ssh "$@";
echo -n -e "\033]0;${USER}@${HOSTNAME%%.*}\007";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment