Created
November 21, 2014 07:13
-
-
Save trbhoang/f1033a3285af00d9db25 to your computer and use it in GitHub Desktop.
name terminal's tab title as hostname on Mac OS
This file contains hidden or 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
| # refs: | |
| # https://coderwall.com/p/hox_hq/keep-terminal-app-tab-name-follow-working-host | |
| # http://wiki.bash-hackers.org/scripting/posparams | |
| # | |
| # customize Terminal tab title | |
| # | |
| function tabname () { | |
| # Change Terminal.app tab name (by josjbuhler) | |
| echo -en "\033];$1\007" | |
| } | |
| function sshname () { | |
| SSHHOST="${@: -1}" | |
| tabname "`echo $SSHHOST`" | |
| unalias ssh | |
| ssh $1 | |
| alias ssh=sshname | |
| tabname $USER'@localhost' | |
| } | |
| alias ssh=sshname | |
| tabname $USER'@localhost' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment