DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Customizing your environment

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:

PS1='$PWD'

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


NOTE: 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.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004