lnlidawei

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

【fedora】 PS1 Setting for Bash

 

 

 

 

一、【PS1】设置(    PS1='[\[\033[1;31m\]\u@\h:\W\[\033[00m\]]$ '    )

 

# position: /etc/bashrc
# date: 20250416
if [[ $USER = "root" ]] 
then
        PS1='[\[\033[1;31m\]\u@\h:\W\[\033[00m\]]# ' 
else
        PS1='[\[\033[1;31m\]\u@\h:\W\[\033[00m\]]$ ' 
fi

 

 

[wit@fedora:tmp]$ cat ~/.bashrc 
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]; then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
    for rc in ~/.bashrc.d/*; do
        if [ -f "$rc" ]; then
            . "$rc"
        fi
    done
fi
unset rc


PS1='[\[\033[1;31m\]\u@\h:\W\[\033[00m\]]$ '

 

 

 

二、参考资料

 

  1、  PS1  --  man bash;  /PROMPTING;  /PS1

 

posted on 2025-03-18 13:52  lnlidawei  阅读(13)  评论(0)    收藏  举报