Set screen-title from shellscript

后端 未结 12 1675
忘掉有多难
忘掉有多难 2020-12-12 16:48

Is it possible to set the Screen Title using a shell script?

I thought about something like sending the key commands ctrl+A shift-

12条回答
  •  感动是毒
    2020-12-12 17:51

    I tried this on Ubuntu 18.10 and it only worked with PROMPT_COMMAND in ~/.bashrc. And if you override PROMPT_COMMAND, the behavior of the title changes slightly. I decided to change only if necessary:

    t() {
      TITLE="$@"
      PROMPT_COMMAND='echo -ne "\033]0;${TITLE}\007"'
    }
    

    enter image description here

提交回复
热议问题