查看: 52|回复: 0

【fedora】 PS1 Setting for Bash

[复制链接]

2

主题

0

回帖

0

积分

热心网友

金币
0
阅读权限
220
精华
0
威望
0
贡献
0
在线时间
0 小时
注册时间
2011-4-17
发表于 2025-3-18 13:52:00 | 显示全部楼层 |阅读模式

【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/binHOME/bin:" ]]; then
    PATH="$HOME/.local/binHOME/binPATH"
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

 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部