spinix-hive/manpages/shell.txt

102 lines
3.7 KiB
Plaintext

SHELL(1) User Commands SHELL(1)
NAME
shell - Spinix shell program
SYNOPSIS
shell
DESCRIPTION
Provides the command-line interface for the Spinix operating system.
The shell program can execute the following commands:
pwd - print the current working directory
cd - change working directory
echo - echo the command line parameters
FILE - execute FILE
Executable files can be one of the following:
- Spinix Spin application
- Spinix C application
- Stand-alone C or Spin program
- script file
Spinix examines the first long of a file to determine what type of
executable it is. A Spin app contains "SPIN" and a C app contains
"CAPP". C apps must use the LMM memory model.
A stand-alone C or Spin program is signalled by a clock frequency
between 80 and 120 MHz. Spinix will modify the clock frequency to
match the current clock frequency when the stand-along program is run.
It does not modify any other portion of the program.
C and Spin programs must be less than or equal to 31.5K bytes since the
spinix shared memory is located in the top 512 bytes of memory.
Program files must consist of contiguous sectors, since the loader does
not implement cluster chaining. This can be ensured by using 32K
clusters.
Standard I/O can be redirected by using the ">", "<" and ">>" comand-
line modifiers.
The first line of a script file must start with "#shell". Script file
can call another script file up to 26 levels deep.
Shell script files support the following commands:
if - conditionally execute based on following condition
then - must be on the next line after an "if" line
fi - terminates the body of an if statment
while - begin conditional loop based on following condition
do - must be on the next line after a "while" line
done - terminats the body of a while statement
exit - exit the script file
An if statement may contain an executable file, such as
if spinit file
or
if test $a -ne 0
The if statement will test the return value from the executable file,
which is referenced by $?. A short-hand version of using test is to
use bracket, so that the "if test" statement above can be written as
if [ $a -ne 0 ]
The shell allows defining variables using the "=" operator, such as
a=123
There must be no spaces before or after the equal. Double quotes
can be used to assign a value containing spaces, such as
b="This is a test"
Variables can be accessed by prepending a "$" character to the name.
From the previous examples, a and b can be printed using echo by
typing
echo $a $b
Spinix provides other variables, which are $?, $#, $1, $2, etc.
$? contains the return value from the last program that has been
executed. $# contains the number of command-line parameters, and
$1, $2, etc. contain the values of the command-line parameters.
LIMITATIONS
AUTHOR
Dave Hein
COPYRIGHT
Copyright (c) 2011, 2012, 2013, Dave Hein
MIT License (See license.txt in the root directory)
This is free software: you are free to change and redistribute it.
There is no warranty, to the extent permitted by law.
SPINIX utility March 2012 SHELL(1)