【问题标题】:tput: No value for $TERM and no -T specified in Sublime Text3tput:在 Sublime Text3 中没有指定 $TERM 的值并且没有指定 -T
【发布时间】:2018-08-13 13:33:14
【问题描述】:

当我在 Sublime Text3 中构建 C++ 编程时,我在任何控制台输出的开头都会看到以下几行:

这是我~/.bash_profile的内容:

# Setting PATH for Python 2.7
# The original version is saved in .bash_profile.pysave
PATH="/System/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"

export PATH


# added by Anaconda3 5.0.1 installer
export PATH="/Users/zhuliwen/anaconda3/bin:$PATH"
export CLICOLOR=1  
export LSCOLORS=gxfxaxdxcxegedabagacad  

# export PS1="\[\033[38;5;10m\]\u@\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tp    ut sgr0)\]\[\033[38;5;220m\]\w\[$(tput sgr0)\]"
# export PS1="\[\033[38;5;10m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput     sgr0)\]\[\033[38;5;220m\]\w\[$(tput sgr0)\]"
export PS1="\[\033[38;5;10m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sg    r0)\]\[\033[38;5;220m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]\\$ \[$(tput sgr0)    \]"

alias ls='ls -G'
alias grep='grep --color' 

我该如何解决这个问题?谢谢

【问题讨论】:

  • 你能把你用来执行构建的 sublime-build 包括进来吗?

标签: bash macos terminal sublimetext3


【解决方案1】:

当您通过这样的应用程序进行构建时,通常您没有用于输出的真实终端(但如您所见,您可以运行 shell 脚本)。为避免该消息而采取的措施

  • 修改您的 bash 配置文件以仅在它是交互式会话或输出满足 shell 对“tty”的检查时才执行这些分配,例如,
 如果 [ -t 0 ]
    然后
        导出 PS1="\[\033[38;5;10m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sg r0)\] \[\033[38;5;220m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]\\$\[$(tput sgr0)\]"
    菲
  • 或者,您可以设置TERM 以匹配开发人员声称输出“终端”匹配的任何内容。有时这行得通。

【讨论】:

    猜你喜欢
    • 2017-07-27
    • 2021-07-31
    • 1970-01-01
    • 2020-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-26
    相关资源
    最近更新 更多