<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">
<wml>
 <!-- page name="prompt"-->
 <template>
  <do optional="false" label="Back" type="prev">
   <prev/>
  </do>
 </template>
 <card ordered="true" newcontext="false" id="prompt1a">
  <do optional="false" type="options" label="Next">
   <go enctype="application/x-www-form-urlencoded" method="get" sendreferer="true" href="cmdedit.wml#cmdedit1a"/>
  </do>
  <p>For most users, the default prompt in the Korn shell is a dollar sign: </p>
  <p align="left">$</p>
  <p>For root, the prompt is a hash symbol: </p>
  <p align="left">#</p>
  <!-- h1 -->
  <h1>Changing the Korn shell prompt</h1>
  <p>The prompt can be changed by setting the PS1 environment variable. For example: </p>
  <p align="left">export PS1='$PWD ! $ 'export PS1='${PWD#${PWD%/*/*}/} ! $ 'export PS1="$LOGNAME@`uname -n` \$PWD ! $ "</p>
  <p>$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. </p>
  <p align="left">
   <a href="cmdedit.wml#cmdedit1a">Next: Set Editor</a>
   <br/>
   <a href="index.wml">Back Up: Korn</a>
   <br/>
  </p>
 </card>
</wml>

