The prompt displayed by your shell is contained in a shell variable (6.8) called prompt in the C shell and PS1 in the Bourne shell. As such, it can be set like any other shell variable. [bash and tcsh have plenty of extra features for those two variables. There are examples in later articles. -JP]
So, for example, if I wanted to change my C shell prompt to include my login name, I might put the following command into my .cshrc file:
set prompt="tim % "
(It's helpful to leave the %
at the end so that it remains obvious
that this is a C shell.
The space after the %
makes the command you type stand out from the rest
of the prompt.)
Or if I wanted to put in the name of the system I was currently logged in on, I might say:
`...` uname -n | set prompt="`uname -n` % " |
---|
If I wanted to include the history number for each command, (11.1) I'd say:
set prompt="\! % "
Or if I wanted all three things:
set prompt="tim@`uname -n` \!% "
This will give me a prompt like this:
tim@isla 43%
-