Configuring and working with the shells

Making your prompt tell you where you are

One variable in .login or .profile that you might want to adapt is your prompt variable. The prompt variable contains the character or characters that the shell prompts you to enter a command with. The main prompt string is contained in the Korn shell or Bourne shell variable PS1. If you press <Enter> to start a new line without completing a command, the shell will prompt you with the PS2 (second level) prompt variable. (If you are using the C shell, your prompt string is stored in the variable prompt.)

For example:

   $ echo "
   > hello, world!
   > This is a test.
   > "

hello, world! This is a test. $

In the Korn shell only, you can make the prompt string display your current working directory by editing .profile and setting the variable (as in the .profile above) like this:


You must then reset your environment for the change to take effect. See ``Resetting the environment'' for details.

Note that the variable PS1 is almost certainly present in one of your startup files already; if you insert the example line above and forget to remove the old setting, then whichever version of PS1 was specified last in the file will be used.

Next topic: Adding a logout script
Previous topic: Some features to make life easier

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003