|Changing your system prompt
| Use the prompt variable to redefine your system prompt.
Use Prompt variable to redefine your 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
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:
- 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%.
- 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.
- 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 %"
More complex prompts
can be defined. In the next lesson, storing your custom settings will be discussed.