Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.