小编Ris*_*ngh的帖子

防止 Windows 终端标题更改

我正在尝试 Windows 终端。我使用 bash 并希望 Windows 终端选项卡标题保留为 cwd(最初由 bash 设置)而不是更改,因为在使用多个选项卡时它们变得难以区分。如果我npm run start直接在 bash 中运行 say,标题(在标题栏中)仍为 cwd,但如果我尝试通过 Windows 终端使用它,选项卡标题将更改为 npm,这是我不想要的。

我的.bashrc

if test -f /etc/profile.d/git-sdk.sh
then
    TITLEPREFIX=SDK-${MSYSTEM#MINGW}
else
    TITLEPREFIX=$MSYSTEM
fi

if test -f ~/.config/git/git-prompt.sh
then
    . ~/.config/git/git-prompt.sh
else
    # PS1='\[\033]0;$TITLEPREFIX:$PWD\007\]' # set window title
    # PS1='\[\e]0;\W\a\]\[\033]0;$PWD\007\]' # set window title (full path)
    PS1='\[\e]0;\W\a\]' # set window title (only directory name)
    PS1="$PS1"'\n'                 # new line
    PS1="$PS1"'\[\033[32m\]'       # change to green
    PS1="$PS1"'\u '             # user@host<space>
    # PS1="$PS1"'\[\033[35m\]'       # change to …
Run Code Online (Sandbox Code Playgroud)

windows terminal

1
推荐指数
1
解决办法
3175
查看次数

标签 统计

terminal ×1

windows ×1