Created
January 8, 2012 18:59
-
-
Save entaroadun/1579312 to your computer and use it in GitHub Desktop.
Setting Mac OS X Terminal title in bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## ##################### | |
## ## 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