Skip to content

Instantly share code, notes, and snippets.

@trbhoang
Created November 21, 2014 07:13
Show Gist options
  • Select an option

  • Save trbhoang/f1033a3285af00d9db25 to your computer and use it in GitHub Desktop.

Select an option

Save trbhoang/f1033a3285af00d9db25 to your computer and use it in GitHub Desktop.

Revisions

  1. trbhoang created this gist Nov 21, 2014.
    23 changes: 23 additions & 0 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    # 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'