For most users, the default prompt in the Korn shell is a dollar sign:
$
For root, the prompt is a hash symbol:
#
The prompt can be changed by setting the PS1 environment variable. For example:
export PS1='$PWD ! $ '
export PS1='${PWD#${PWD%/*/*}/} ! $ '
export PS1="$LOGNAME@`uname -n` \$PWD ! $ "
$PWD shows the path for the current directory. ${PWD#${PWD%/*/*}/} uses Korn shell pattern matching to show only the last two directories in the current directory path. ! shows the number of the command in the command history. When setting the prompt with a double-quoted ("...") string, unescaped variables, such as $LOGNAME above, and commands, such as `uname -n` above, are interpreted when the environment variable is exported, and therefore will not change unless the prompt is set again.
Home > Computers > Operating Systems > UNIX > Shell > Korn > Prompt
Viewing mobile website page. Switch to WML or Full HTML