mirror of
https://github.com/Linux4Yourself/book.git
synced 2025-01-24 23:32:18 +08:00
40 lines
1.1 KiB
Markdown
40 lines
1.1 KiB
Markdown
|
```bash
|
||
|
cat > /etc/bashrc << "EOF"
|
||
|
# Begin /etc/bashrc
|
||
|
# Written for Beyond Linux From Scratch
|
||
|
# by James Robertson <jameswrobertson@earthlink.net>
|
||
|
# updated by Bruce Dubbs <bdubbs@linuxfromscratch.org>
|
||
|
|
||
|
# System wide aliases and functions.
|
||
|
|
||
|
# System wide environment variables and startup programs should go into
|
||
|
# /etc/profile. Personal environment variables and startup programs
|
||
|
# should go into ~/.bash_profile. Personal aliases and functions should
|
||
|
# go into ~/.bashrc
|
||
|
|
||
|
# Provides colored /bin/ls and /bin/grep commands. Used in conjunction
|
||
|
# with code in /etc/profile.
|
||
|
|
||
|
alias ls='ls --color=auto'
|
||
|
alias grep='grep --color=auto'
|
||
|
|
||
|
# Provides prompt for non-login shells, specifically shells started
|
||
|
# in the X environment. [Review the LFS archive thread titled
|
||
|
# PS1 Environment Variable for a great case study behind this script
|
||
|
# addendum.]
|
||
|
|
||
|
NORMAL="\[\e[0m\]"
|
||
|
RED="\[\e[1;31m\]"
|
||
|
GREEN="\[\e[1;32m\]"
|
||
|
if [[ $EUID == 0 ]] ; then
|
||
|
PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL"
|
||
|
else
|
||
|
PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
|
||
|
fi
|
||
|
|
||
|
unset RED GREEN NORMAL
|
||
|
|
||
|
# End /etc/bashrc
|
||
|
EOF
|
||
|
```
|