14.3 C Shell Features
14.3.1 Custom prompts in the C shell
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).

  1. % set prompt="Get started %" - This form of the command sets the prompt to a fixed string.
  2. 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.
  3. Hello venus set prompt="% " - Sets the prompt back to the default C shell prompt of %.
Interactive Media Activity (Flash, 93 kB)
  Customizing your Prompt with C Shell

In this media activity, you are logged into a C Shell as user2 and your current working directory is: /home/user2. Type the commands that would accomplish the requested objectives. Note: Be sure to press enter after each one. Click on step 1 to begin.