7.2.4.1. Introduction
The Bash prompt can do much
more than displaying such simple information as your user name, the
name of your machine and some indication about the present working
directory. We can add other information such as the current date
and time, number of connected users etc.
Before we begin, however, we will save our current prompt in
another environment variable:
[jerry@nowhere jerry]$ MYPROMPT=$PS1
[jerry@nowhere jerry]$ echo $MYPROMPT
[\u@\h \W]\$
[jerry@nowhere jerry]$
|
When we change the prompt now, for example by issuing the
command PS1="->", we can always get our
original prompt back with the command PS1=$MYPROMPT. You
will, of course, also get it back when you reconnect, as long as
you just fiddle with the prompt on the command line and avoid
putting it in a shell configuration file.