首页 > 解决方案 > 摆脱“警告:命令替换:输入中忽略的空字节”

问题描述

我最近升级了 bash,现在打开新终端时出现此错误:

-bash: warning: command substitution: ignored null byte in input

这是我的 .bash_profile 中导致问题的行:

PS1="\[ $txtblu\w$txtgrn\$(branch)$txtwht ∴$txtrst \]"

NB Bash 版本

bash --version
GNU bash, version 5.0.0(1)-release (x86_64-apple-darwin18.2.0)

我需要更改哪些内容才能删除此警告?

变量:

txtrst='\[\e[0m\]'    # Text Reset
txtblu='\[\e[0;34m\]' # Blue
txtgrn='\[\e[0;32m\]' # Green
txtwht='\[\e[0;37m\]' # White
txtred='\[\e[0;31m\]' # Red

标签: bashshell

解决方案


推荐阅读