Shell Programing


break                     -- escape from function 
for                       -- loops 
if                        -- logical cases 
input                     -- read command lines from a file 
macro                     -- deal with the macros

There are several options for programming in status. First, a file which contains a series of commands can be executed with input (filename). It is also possible to define macros which will behave much like regular commands. A macro is defined by typing macro name or macro create name followed by the commands. Arguments to the macro are assigned to the variables $1 .. $N and the number of arguments is given by $0. Macros may be defined in input files, and in fact when status is started, it loads the file /.statusrc which may contain default macros. Simple loops and if statements can be performed, and are quite useful for complex macros.

``If'' statements are similar in syntax to C if statements, but only the following logical operators are available: $>$, $<$, $=$, !, $\vert$, and &. Notice that (currently) there is no $>=$ or $<=$ symbol. The operator ! means ``not equal to'', but cannot be used to negate a logical value. The operators $\vert$ and & have the meaning of ``or'' and ``and'' respectively. Math expresions in the if statement must be contained in curly braces, as elsewhere. Variables with string values may use the logical $=$ operator to test if two strings are the same. ``For'' loops are quite simplistic. The form is:


for var first last delta
 (commands)
end
The value of $var will start at the value first and increment by delta after each loop. The loop will stop after $var is greater than stop. The value delta is optional, with 1 assumed. The value of $var may be changed during the loop, and if set beyong the value of last will end the loop early.



Eugene Magnier
2001-03-20