Allow the jsh prompt to be configured via an environment variable
Previous Release Behavior
The jsh prompt was not particularly configurable, there were 3 options...
First, use the -pPROMPT option when starting the jsh.
Second, edit $JBCRELEASEDIR/tmp/jutil_ctrl/jsh_o_portno.
Third, the commands set jps1 newprompt and set jps2 newprompt could be used to change the primary and/or secondary default prompts but those commands could only be entered within the jShell.
None of those options were particularly useful in a real-world environment.
Current Release Behavior
You can now utilize the JSH_PROMPT environment variable to contain up to 3 values delimited by a comma, as in
set JSH_PROMPT=JSH_PROMPT="$%%s $%%a $%%c -->","$%%>>>",jsh [Windows] export JSH_PROMPT=JSH_PROMPT="$%s $%a $%c -->","$%>>>",jsh [Linux]
- The first field shown in the example is the primary prompt which the jsh user initially sees
- The second field shown is the secondary prompt which the jsh user sees when a select list is present
- The third field shown is the jsh mode of operation, either jsh, msh or sh
Field 2 and 3 are optional and will take the usual defaults if not specified.
Note that, on Windows, you must escape the % symbol.
Fields 1 and 2 can accept values from the following table:
||the value of the specified Environment Variable
||the user account name
||the phrase "(Cmd)" if the shell is in command mode
||a new line sequence
||the current working directory
||the current working directory with any portion matching the home directory replaced with ~
||the port number
||the entry number in the stack currently being edited
||the current date in dd mmm yyyy format
||the time of day in hh:mm:ss format
||the host name as defined by the UNIX command uname (UNIX only)
||the tty name (UNIX only)
||the name of the jshelltype that will execute the commands at the prompt
||all other characters are taken as literals and included in the prompt
The -pPROMPT option to jsh has also been enhanced so that it can take up to 3 fields in the same format as the JSH_PROMPT environment variable.