Class Shell

Object
  extended byShell

public class Shell
extends Object

A simple command-line shell for the MiniKernel.

This program displays a prompt and waits for the user to enter command lines. A command line consists of one or more commands, separated by ampersands (&). A command is the name of a Java class that implements public static void main(String args[]), followed by zero or more arguments to the command. All the commands on the line are run in parallel. The shell waits for them to finish before issuing another prompt.

The Shell terminates if it sees end-of-file (Control-D if input is coming from the keyboard).

If this shell is invoked with any arguments, they are joined together with spaces and run as a single command line. For example,

      java Shell Test foo "& Test bar"
 
is equivalent to
      java Shell
      Shell> Test foo & Test bar
      Shell> exit
 

The Shell also has the following "built-in" commands. Any arguments are ignored.

exit
The Shell terminates immediately.
help
The Shell prints a short help message.
?
Equivalent to help.

See Also:
Kernel

Field Summary
private static String[] help
          Help message, one line per element.
 
Constructor Summary
Shell()
           
 
Method Summary
static void main(String[] args)
          The main program.
private static void runCommandLine(String line)
          Parses and runs one command line.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

help

private static String[] help
Help message, one line per element.

Constructor Detail

Shell

public Shell()
Method Detail

main

public static void main(String[] args)
The main program.

Parameters:
args - command-line arguments. If empty, prompt the user for commands.

runCommandLine

private static void runCommandLine(String line)
Parses and runs one command line.

Parameters:
line - the command line to run.