[英]customize bash prompt based on groups
我正在嘗試根據用戶組自定義bash提示,但不確定如何處理它。
對於開發組中的用戶,我希望導出PS1 =為:
"[\u@\h\[$(tput setaf 3)\]\[$(tput bold)\](devel) \[$(tput sgr0)\]\W]\\$ \[$(tput sgr0)\]"
對於那些下面的人,我希望它是:
"[\u@\h\[$(tput setaf 3)\]\[$(tput bold)\](infra) \[$(tput sgr0)\]\W]\\$ \[$(tput sgr0)\]"
對於其他所有人,我希望它使用默認值。
有任何想法嗎?
為每個設置提示的組創建一個.bashrc
在etc / profile中:
if [ `id -ng` = "some_group" ] ; then # load group bashrc fi
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.