There are a number of prompt variables in the Korn shell: PS1 and PS2 are two of them. PS1 contains your primary prompt string and is displayed by the Korn shell when it is ready to read a command. If not specified, the default is $ for regular users, and # for superusers.

PS2 specifies the secondary prompt string and is displayed whenever the Korn shell needs more input. For example, when you press <RETURN> before a complete command has been given, or continue a command onto the next line with the \ character, the PS2 variable is displayed. If not specified, the default for PS2 is the > character.

$ print "Here is 
> another line" 
Here is another line 

Customizing Your Command Prompt

By default, the command prompt is set to the $ character. But you could set it to something else by simply reassigning a value to the PS1 variable. For example, you could have the prompt give you a greeting message like this:

$ typeset —x PS1="Good morning " 

As soon as you press the <RETURN> key, the prompt is reset.

Good morning: pwd 
Good morning: 

The current command number can be displayed by putting a ! in the prompt variable PS1 like this:

$ typeset —x PS1="!:Good morning:" 
154: Good morning: 

If you really want to display a ! in the prompt, use !!:

$ typeset —x PS1="Hello there!!" 
Hello there! 

Now let's make a fancy prompt that will display the command number and the current working directory. Besides ! for the command number, we'll need the PWD variable for the current working directory.

$ typeset —x PS1="!:$PWD> " 

Just to make sure it works, let's change directories:

167:/home/anatole> cd /tmp 
168:/tmp> cd /usr/spool/news/comp/sources 

Don't go overboard with this. If you are using the in-line editor, remember that the prompt size affects the edit window width.

     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows