A SORCER Network SHell (nsh) provides a command line interface for interfacing with the SORCER platform. The command line interface for nsh is described in the following sections:
The nsh provides the following default arguments:

${SORCER_HOME}/bin/shell/bin/nsh [-f <filename>] [options] | [--<application name> | [options] 

    -f <filename> [options]
    Execute the netlet (a mogram in the Service Modelinng Language (SML)) specified by the file <filename>.
    The shenbang synatx, e.g., #!/path/to/nsh -f can be used directly in executable SML scripts.
    --<application name> | [options]
    Start a default or custom application, tool or utility. 
Default nsh application names: blitz Start a Blitz JavaSpaces browser Start a SORCER service browser cataloger Start a SORCER service catalog emx Start a SORCER Exert Monitoring service jini Start Jini basic services jobber Start a SORCER Jobber (a push rendezvous service) locker Start a SORCER service lock manager logger Start a SORCER logging service mmx Start a SORCER Model Monitoring service sos Start basic SORCER operating system services spacer Start a SORCER Spacer (a pull rendezvous service) webster Start a standalone code server (webster)
   For defining custom applications see: Configuring the nsf shell below.

	groups=group1,group2,...        Comma separated names of multicast groups to
    					discover. If "all" is provided, this will be
                        		translated to DiscoveryGroupManagment.ALL_GROUPS
	locators=jini://host[:port]     Comma separated names of lookup locators to discover
	discoveryTimeout=millis         Discovery timeout (in milliseconds)
	httpPort=port                   Port to use when starting Webster files

	roots=root1,root2,...		Root directories for Webster

	jars=jar1,jar2,...              Exported classes by this shell (codebase)

	-noHttp				Do not start Webster, mutually exclusive
					with the httpPort option

	<file name>.config              An overriding configuratin file for this shell

The nsh shell can be run in either an interactive or non-interactive mode. The Unix shebang syntax can be used with the non-interactive nsh shell (#!/bin/nsh -f or #!/usr/bin/env nsh -f) in executable netlets called directly at the Unix prompt. If the non-interactive nsh shell is invoked (without -f <filename> or --<application name>) then for ? or help commands the user is presented with the following help info:

You can manage and interact with the SORCER network using the following commands:

	cd: 		cd <directory name> | ~
	chgrp: 		chgrp <groups> | chgrp -r <registrar index> <groups>
	chport: 	chport <lookup service index> port
	clear: 		clear -a | -p | -m | -e
	dir: 		dir [-l]
	disco: 		disco [<registrar index> | -v]
	edit: 		edit [<filename>]
	exert: 		exert [-cc] [[-s | --s | --m] <output filename>] <input filename>
  	groups: 	groups [-d]
	gvy: 		gvy <input filename> [-s <output filename>]
	help: 		help &ld;command> | ? 
	http: 		http [port=<port-num>] [roots=<http roots>] [jars=<http jars>] | stop
	ig: 		ig -h | -n
	info: 		info [-a]
	ls: 		ls [-l]
	lup: 		lup  [-s | -p | <service index> | -v | -x] | --d <service index>
			      | ( -p | -s ) [-n <name attribute value>] [-i <service type name>] 
	mxe: 		mxe [-m | -m <EMX index> | -v | -x]
			      | [ -a | -d | -f | -r | -y | <exertion index>] 
			      | (-e | -c | -cc | -ccc) [<exertion index>] [-s <filename>]
	pwd: 		pwd
	start: 		start <application name>
	stop: 		stop <lookup service index> | all

For help on any of these commands type 'help [<command>]'.
To leave this program type 'quit'

Shell specific commands

Directory based commands
Path of working directory
Change directory; the "~" character can be used, this will change back to the nsh shell's home directory
Directory listing of the current working directory
Synonomous with the ls command


Change discovery/lookup groups for this shell
Change a port of a given lookup service in the network
For browsing and inspecting lookup services in the network
Show the nsh shell groups
For browsing finding and inspecting services in the network
Strarts SORCER and user defined services
Destroys the selected lookup service or all of them


Removes all fetched shell's resources or a selected service provider, exert monitor, or exertion
Opens the editor specified by $NSH_EDITOR or by the application name 'editor' in the shell initialization file nsh-init.config
Manages and executes the federation of services specified by the input file
Execute a Groovy script in a given file
Lists all shell commands and describe each of of them
Starts and stops Webster instances.
Shows this shell properties; details are shown for the current user, time logged in, the http server, selected registrar, exert monitor and, (-a) information on applications that can be started by this shell.
For monitoring executing exertions in the network
For monitoring modeling services in the network
Runs the previous command again

By default, the nsh starts a {@link sorcer.tools.webster.Webster} instance, which is used to serve jars needed by the executing exertions (the exert commnad). If a Webster instance is not desired, use the -noHttp option


If you are running the nsh on OS X (or other unixes) to use your up & down arrows for command line retrieval, install rlwrap. The SORCER nsh script calls rlwrap when installed. You can create a symblolic link in your $HOME/bin directory

ln -s ${SORCER_HOME}/bin/shell/bin/nsh ./nsh

rlwrap is a readline wrapper, a utility that allows the editing of keyboard input for any other command. If not installed, open the terminal and type: sudo port install rlwrap

Configuring the nsh shell
The nsh shell startup script can be specifued by the environmt variable NSH_STARTUP or by $HOME/.nsh/startup.

User defined classes for the shell can be specified by the environment variable CLASSPATH or in a shell start configuration. The nsh start configuration file can be specified by the environmt variable NSH_CONF or by $HOME/.nsh/configs/nsh-start.config; the default file is $SORCER_HOME/bin/shell/configs/nsh-start.config.

The default shell initialization file $SORCER_HOME/bin/shell/configs/nsh-init.config is used if present. Alternatively an initialization file (with the config extention) can be passed as the first argument to the nsh or placed in $HOME/.nsh/configs. The nsh initialization file supports the following configuration entries, with component sorcer.tools.shell.NetworkShell.