Unix Concepts   «Prev  Next»
Lesson 7Changing your system prompt
Objective Use the prompt variable to redefine your system prompt.

Changing Unix System Prompt

By default, the C shell uses the percent sign (%) as a prompt. You can change the default by redefining the C shell’s prompt variable , using this general form:

% set prompt=value

Prompt variable : The prompt variable is a C shell variable that stores the value of your shell prompt.
For example, to set your prompt to Hello there %, use this command:
% set prompt="Hello there %" Hello there %

Note the following:
  1. First, it is a UNIX convention to keep the default character at the end of a prompt. This helps you identify your shell. For example, the prompt for your course account is lab2%.
  2. Second, the prompt value must be supplied as a single argument. Because Hello there % contains spaces, the phrase is quoted. This causes the shell to treat the value as a single argument instead of as two.
  3. Finally, notice that the new prompt appears right after you set it.

As another example, if I wanted to change my prompt to include my user ID, I would enter the following:
% set prompt="danielg %"
danielg %

More complex prompts can be defined.
In the next lesson, storing your custom settings will be discussed.