首页 > 解决方案 > 在 Bash Mac 中不换行

问题描述

我正在编辑我的 .bash_profile 并将我的 PS1 设置为

PS1="$(tput setaf 117)Adam$(tput setaf 71)\W $(tput setaf 228)$ $(tput sgr0)";

颜色是我想要的颜色,但正如您在图片中看到的那样,我试图 cd 进入的目录名称与当前行重叠,而不是换行。有任何想法吗?

在此处输入图像描述

标签: bashmacosterminal

解决方案


我忘了用 /[ /] 固定版本包装:

PS1="\[$(tput setaf 117)\]Adam/\[$(tput setaf 71)\]\W  \[$(tput setaf 228)\]-> \[$(tput sgr0)\]";ere

推荐阅读