jSHELL


The jsh command invokes jSHELL - the jBASE shell. It can be invoked as your login shell by using the normal system administration software supplied with the platform. Either via .bat files (Windows) or .profiles (Unix ).

jSHELL has been designed to ease migration from older systems, and to overcome some of the differences between various platform command line environments. The more primitive features seen on some older platforms (such as the "dot" command stacker) have been replaced with easier to use and more functional equivalents.

The most noticeable difference between jSHELL and other command line shells, such as the Unix Korn shell (ksh), is that command line arguments such as "*" and "?" are not expanded by the shell but passed directly to the command that has been invoked. In same manner, quoted strings (such as "quoted string") are passed directly to the command with quotes intact. This enables query language statements such as:

SSELECT file = "[SPROUT]" BY *A1

to be issued directly from jSHELL. If the same command was issued from the ksh prompt, it would have to be issued as:

SSELECT file = \"[SPROUT]\" BY \*A1

to avoid the quotes being removed and the "*" being expanded by the Korn shell.

Beyond this convenient feature, jSHELL also offers many significant advantages over traditional shells and is easier to use. Some of the main features of the jsh are:

  • Customizable prompt
  • Alternate shell/command line invocation
  • Command search and recall
  • Active select list prompt
  • Proc detection and execution
  • Type-ahead is supported

 

JSH COMMAND SYNTAX

jsh - -c command -s shell -p prompt

Option Description
- Execute proc from MD/VOC file with same name as user login. (on Unix the .profile and .jshrc files are processed)
-c command Specifies that a jsh process should be spawned to execute command. When the command terminates, the jsh process will also terminate.
-s shell Specifies which shell emulation to use when executing jsh. The jsh will default to the previous emulation used by the current port.
-p prompt Specifies the prompt to be used while executing jsh.
-t Opens the tty device and accepts commands from the keyboard when the jSHELL has been invoked to process a command input file. The default action is to exit the shell once the processing of the input file has been completed.
-z foreground, background Select foreground and background screen colors (e.g. jsh -z foreground,background). Colors can be WHITE, YELLOW, MAGENTA, RED, CYAN, GREEN, BLUE or BLACK. On Windows 95/98 the defaults are BLUE foreground and WHITE background (i.e. jsh -z will be blue on white). On Windows 2000, colors can be globally set using the Console setup from the Control Panel or by selecting the Properties of a jShell shortcut.

Note: If the jsh command is issued without arguments, a jsh process is spawned and this process becomes your command shell. The jsh process will replace the current shell if it is invoked through the UNIX exec command.

 

USING JSH

To use this tutorial you will need to be logged in to your system and positioned at the shell prompt. If your user account has not been configured to run jSHELL by default, execute it now like this:

exec jsh -       [unix/Linux]
jsh.exe -         [Windows]
Note: Some Unix SVR4.x systems have there own shell called jsh. If the PATH environment variable includes the directory containing the SVR4x native jsh before the jBASE release directory path, you may execute the native version rather than the jBASE version. You can either change the PATH list or use the absolute path name to the jsh executable.

The default jSHELL prompt should now appear:

jsh user cwd -->

Where user is your login name and cwd is your current working directory. For this exercise we will assume that your login name was jbase and that your current working directory is the home directory for jBASE. In this case your prompt will look like this:

jsh jbase ~ -->

The tilde character (~) is a short-hand method of referring to your home directory. The shell expands this character to the full path name of your login home directory before executing commands. If you had changed to a sub-directory called source your prompt would now look like this:

jsh jbase ~ --> cd source
sh jbase ~/source -->

You can change the primary and/or secondary default prompts by using the following commands:

jsh jbase ~ -->set jps1 newprompt
jsh jbase ~ -->set jps2 newprompt
Note: The secondary prompt is only displayed for an active select-list, i.e. after a SELECT, GET-LIST, QSELECT, BSELECT, etc.

Where newprompt is a string defining the new prompt. The string can contain terminal control characters such as a bell character by specifying special character sequences in the newprompt string. The character sequences allowed are:

Sequence Replaced With
$EnvVar the value of the specified environment variable
$%a the user account name
$%m the phrase "(Cmd)" if the shell is in command mode
$%n the new line sequence
$%C the current working directory
$%c the current working directory with any portion matching the home directory replaced with ~
$%p the port number
$%e the entry number in the stack currently being edited
$%d the current date in dd mmm yyyy format
$%t the time of day in hh:mm:ss format
$%u the host name as defined by the UNIX command uname (UNIX only)
$%y the tty name (UNIX only)
$%s the name of the jshelltype that will execute the commands at the prompt
chars all other characters are taken as literals and included in the prompt

The shell operates in two distinct modes, command mode and operating mode. Operating mode is the usual mode and is used to issue all commands to the system. Command mode is used to issue commands to jsh itself.

There is only one command available in the current implementation of jsh - the / command. This character introduces a search string to jsh. The search string is compared against every command in your command history and if a match is found, the command is recalled as the current command, just as if you had typed it in again. Command mode is normally entered by hitting the escape key on your keyboard.

If you include the $%m sequence when you configure the prompt, the prompt will change to indicate whether or not you are in the shell command mode. For example, if the prompt has otherwise been left in its default state, the following sequence will locate the last cd command in your command history. Note the appearance of the "(Cmd)" string as part of the prompt on the middle line:

jsh ~ --><Esc>
jsh ~ (Cmnd) -->/cd
jsh ~ -->cd source

Two other keystrokes within jsh allow you to recall up to 50 previous commands. They are:

<Ctrl P> Goto previous command
<Ctrl N>
Goto next command

Using these two keystrokes you can retrace your commands by stepping backwards or forwards one command at a time. If you need to change any part of a command line it is very easy as the jsh supports command line editing by using a subset of the jED editor keys.

In particular, you can use the right and left arrow keys to move the cursor to any position in the current command string. The jsh is configured for editing in insert mode by default. This means that any characters you type will be inserted just before the current cursor position. Use the backspace key to delete the previous character and the <Delete> key to delete the character directly under the cursor. Try recalling a previous command and experiment with the editing keys.

The jsh can be placed into overwrite editing mode by pressing <Ctrl O>. In this mode all characters typed will replace the character under the cursor.

All the editing commands are shown in the following table:

Keystroke Command
<Right> move the cursor right by one character
<Left> move the cursor left by one character
<Home> or <Ctrl A> move the cursor to the start of the command line
<End> or <Ctrl E> move the cursor to the end of the command line
<Down> or <Ctrl N> recall the next command in your history
<Insert> or <Ctrl O> toggle Overwrite/Insert mode, default is Insert
<Up> or <Ctrl P> recall the previous command in your command history
<Ctrl L> list the command history maintained by the shell
<Ctrl K> delete from the cursor to the end of the command line
<Ctrl W> delete from the cursor to the end of the current word
<Tab> move to the start of the next word
<Backtab> move to the start of the previous word

 

JSH EMULATION MODES

If you are already familiar with operating UNIX under other shells, jsh will allow you to work in the environment with which you are most comfortable. You can switch between the various emulation modes in jsh by using the function keys:

F1 jSHELL (jsh)
F2 native Platform Shell. ( CMD.exe, ksh, csh, etc )
F3 mixed shell (msh)

Note that some terminals may not support these function keys. If your terminal does not support the F1, F2 and F3 function keys, the emulation mode can be modified by the jsh internal command, jshelltype. The command syntax is as follows;

jshelltype shell

Where shell can be one of the following:

jsh pre-processes meta characters like the asterisk (*), as expected by legacy multi-value systems. Note that only in jsh mode is JEDIFILENAME_MD examined for Q-pointers, Procs and Paragraphs.
sh native system shell. On Unix depends of SHELL, on Windows CMD.exe.
msh mixed shell. pre-processes meta characters as a combination of jsh and sh.

msh Mapped Sequences

Options specified on the command line will have the leading bracket escaped. For example:

CT File1 Record1 (X becomes CT File1 Record1 \(X

Any asterisk used as part of a record specification is escaped. For example:

CT File1 * becomes CT File1 \*

Quotes used in a selection criteria specification are escaped.

LIST File1 WITH A1 = "XYZ]" becomes LIST File1 WITH \*A1 = \"XYZ]\"

Other meta characters are untouched so that pipes, etc. can be invoked:

cmd | cmd cmd & vi *.c


Man Page Index