Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的一些构建命令使用 osx 命令say在我继续工作时通知我进度。通常,他们使用温和的女性声音,但当我运行命令时,sudo有一个相当粗暴的男子气概告诉发生了什么事。
say
sudo
我认为如果 sudo 命令对其输出有类似的视觉线索会很有用,所以也许输出可以加上前缀*或颜色更改为亮黄色或类似的东西。有什么方法可以实现我想要的吗?
*
也许我可以创建一个别名来sudo改变输出的颜色,然后继续发出 sudo 命令 - 但我不知道如何让颜色变回来。
是否有任何现有系统可以启用此调整?
使用alias sudo="tput setaf 1; sudo".
alias sudo="tput setaf 1; sudo"
要改回颜色,只需添加tput setaf 0到您的PROMPT_COMMAND(in the .bashrc)
tput setaf 0
PROMPT_COMMAND
.bashrc