How does this script for naming iTerm tabs work?

前端 未结 3 1978
难免孤独
难免孤独 2021-02-03 16:41

I\'m trying to name my iTerm tabs and found this link. Here is the pertinent part of the guy\'s post:

I wrote a simple script, which I call “nametab”, whi

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-03 16:57

    rename_tab () {
        TEXT=$1
        export PROMPT_COMMAND='echo -ne "\033]0;${TEXT}\007"'
    }
    

    This is a function. You can add it to your ~/.bashrc (or something similar, like a ~/.bash_profile). To rename the tabs, you can then do this:

    $ rename_tab 'NEW NAME HERE'

提交回复
热议问题