- Prompts:
- PS1: Default interactive
- PS2: Continuation interactive
- PS3: Select (builtin)
- PS4:
set -x
uses this to prefix tracing output
| \a | ASCII bell character (07) | \a$ $ | (and beep)
| \d | Date in “Weekday Month Date” format | \d$ | Wed Mar 08$
| \e | ASCII escape character (033 |
| \h | Hostname up to the first `.’ | \h$ | beebo$
| \H | Hostname | \H$ | beebo.example.com$
| \j | Number of jobs currently managed by the shell | \j$ | 0$
| \l | Basename of the shell’s terminal device name | \l$ | 1$
| \n | Newline | \d\n\h$ | Wed Mar 08 beebo$
| \r | Carriage return | \d\r\h$ | beebo$r 08
| \s | Shell name, basename of
Colour: try something like the following:
STARTCOLOUR='\e[31m';
ENDCOLOR="\e[0m"
PS1="$STARTCOLOUR\h \u% $ENDCOLOR"
Or, if you want to not have weird breaks, and change the colours if you're root (for safety), maybe something like this:
case $(id -u) in
0)
STARTCOLOUR='\[\e[36m\]';
;;
*)
STARTCOLOUR='\[\e[31m\]';
;;
esac
ENDCOLOR="\[\e[0m\]"
PS1="$STARTCOLOUR\h \u% $ENDCOLOR";
Changing the (xterm) title dynamically:
case $(id -u) in
0)
STARTCOLOUR='\[\e[36m\]';
;;
*)
STARTCOLOUR='\[\e[31m\]';
;;
esac
ENDCOLOR="\[\e[0m\]"
case $TERM in
xterm*)
TITLEBAR='\[\e]0;\h \w\007\]';
;;
*)
TITLEBAR="";
;;
esac
PS1="$TITLEBAR$STARTCOLOUR\h \u% $ENDCOLOR"