|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectShell
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.
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 |
private static String[] help
Constructor Detail |
public Shell()
Method Detail |
public static void main(String[] args)
args
- command-line arguments. If empty, prompt the user for
commands.private static void runCommandLine(String line)
line
- the command line to run.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |