Set the terminal tab title as prompt name in unix

痴心易碎 提交于 2019-12-02 01:41:00

问题


Lets say, the prompt is as below

run_scripts >

How to set that terminal tab title same as prompt i.e Terminal tab tile also should be
run_scripts>

So that terminal title should dynamically update when the prompt changes.


回答1:


Many terminals emulators are able to understand the special escaping : "\033]0;foo\007".




回答2:


I know its a old post but i saw it today : Here is the answer:

title `pwd`

if title command does not works in your shell then:

  1. write a shell script with follwing contents (filename = title)
#!/usr/bin/tcsh -f
echo "^[]2;$1^G^[]1;$1^G"
  1. then:
chmod +x title (give this script executable permission)
  1. type:
title `pwd` <enter>


来源:https://stackoverflow.com/questions/16564271/set-the-terminal-tab-title-as-prompt-name-in-unix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!