bash - 在 Bash Mac 中不换行
问题描述
我正在编辑我的 .bash_profile 并将我的 PS1 设置为
PS1="$(tput setaf 117)Adam$(tput setaf 71)\W $(tput setaf 228)$ $(tput sgr0)";
颜色是我想要的颜色,但正如您在图片中看到的那样,我试图 cd 进入的目录名称与当前行重叠,而不是换行。有任何想法吗?
解决方案
我忘了用 /[ /] 固定版本包装:
PS1="\[$(tput setaf 117)\]Adam/\[$(tput setaf 71)\]\W \[$(tput setaf 228)\]-> \[$(tput sgr0)\]";ere
推荐阅读
- html - 使用 CSS 参数化文本的长度
- pandas - Pandas:取每 n 列并堆叠
- c# - 如何在 C# 中动态反序列化 API 的 json 结果?
- java - 如何为实时数据流配置 Apache Flink Cluster (flink-conf.yml)
- javascript - 如何使用 node / express 验证 METHOD GET 请求
- c++ - 两个 std::unordered_map 的交集
- arrays - 我可以替换排序函数返回的单元格中的文本吗
- javascript - 反应钩子形式和 Netlify。不传递表单数据
- mongodb - MongoDB Java 条件查找
- java - 为什么 InputStream 不占用更多内存?