10
09/2014
mac 修改终端标题
在 Ternimal 终端按
但我经常需要在多个终端跑服务,我希望脚本能够自动改标题。这样我就能知道每个终端在干什么。
vim ~/.bash_profile 加入下面函数
function tabname {
printf "\e]1;$1\a"
}
function winname {
printf "\e]2;$1\a"
}
以后就可以
tabname "test" 改标签标题
winname "test" 改窗口标题
我的 node www 脚本
#!/bin/bash cd ./public source ~/.bash_profile tabname "WWW:8888" node ../server.js
bash 不能自动加载 ~/.bash_profile,所以需要 source ~/.bash_profile 引入。
只修改 tab 标题的话,你也可以
title='My first title'echo -n -e "\033]0;$title\007"