The C shell is the other widely used shell
and has a similar feature set to the Korn shell. The default prompt for the C shell is the
percent sign (%). As with the Korn shell, The user can
customize their own shell prompt to their liking. The Korn shell uses
the PS1 variable, whereas the C shell uses the set
prompt command. There is a wide
range of expressions such as character strings, commands, or other
variables that can be used.
Note - there are no spaces
around the equal sign (=).
| Command Format: |
| set prompt=value |
The Figure shows several different ways
to customize the standard prompt (%). Any change in the prompt setting
will remain until the shell is exited or until a sub shell is opened.
To make the customized prompt available from one session to the next,
place the set prompt
command in the .cshrc
(C shell run control) file (covered in Chapter 15).
- % set prompt="Get started
%"
- This form of the command sets the prompt to a fixed
string.
- Get started % set
prompt="Hello, `hostname` "
- The prompt is set to a
fixed string (Hello) followed by a shell variable hostname which
places the name of the computer in the prompt.
- Hello venus set prompt="%
" - Sets the prompt back to the default C shell prompt of
%.
|