是否可以在Bash中为提示添加颜色?
是否可以在Bash中为提示(“user @ host:〜/ dir / $”)着色? 有些命令会产生大量输出,有时很难找到它的起始位置。 着色会有很大帮助。
找到一种简单的方法:
在~/.bashrc
取消注释force_color_prompt=yes
。
Bashish是控制台的主题引擎; 检查一些屏幕截图🙂
它易于安装:
- 单击网站上的下载链接
- 得到Ubuntu的deb
- 双击下载的文件,软件中心将为您安装。
之后,关闭所有打开的终端并键入:
bashish list
获取已构建主题的列表。
玩得开心🙂
其他解决方案的全能替代方案:
如果[$(哪个dircolors)] 然后 如果[-r~ / .dircolors] 然后 评论“$(dircolors -b~ / .dircolors)” 其他 评价“$(dircolors -b)” 科幻 export color_support = true 科幻
此外,您可以在常见命令(如ls
和grep
启用颜色。
if [“$ color_support”= true] 然后 alias ls =“ls --color = auto” 别名grep =“grep --color = auto” 科幻