In order to make the toolbar components do things commands must be attached to them. This is accomplished by using command lists. Command lists are mini programs written in a very limited language. The language can only call functions that are built into lortug, call shell commands, substitute variables and make simple decisions (I hesitate to call it branching since it is so limited).
Central to command lists in the notion of expansion. Expansion is the substituting of either the output from a command or the value of a variable into another command. This is accomplished by enclosing the function call or variable in {}. This allows one to use the value of a variable or the output from another command as the argument to another command.
There are four components that can be used in a command list: built-in functions, shell commands, variables and decisions.
Built-in functions: These are functions that are built into lortug (for a list see Built-in Commands). Syntax for the functions is
[function name]([arg1], [arg2], ...)
Built-in functions are recognised by the parentheses following the function name. If there are not enough arguments in a function call specified in the script then lortug ] will issue an arror when parsing the script.
Shell commands: These are commands that are passed to the shell. When executed at the top level of a command list (ie when the command isn't enclosed in {}) the command is executed and lortug doesn't wait for it to finish (if waiting for a command to finish is desired the Shell Built in command should be used). When used in an expansion operator ({}) the command must be prefaced with a ! (ie {!ls}).
Variables: variables can only appear within expansion operators (ie {var}). When this is done the value of the variable is substituted.
Decisions: A decision checks whether a variable or the output from a built-in function or shell command is true or false (where true is when the variable isn't empty and false is when it is empty) and then substitutes one of two strings (the strings can further be expanded variables or commands). The syntax is:
{[var or command to expand] ? [string 1] : [string 2]}
An actual command list is built up by nesting the above elements inside each other to create single commands and then these commands are put into a list that is executed in order. The toplevel commands are delimited by ;'s. Any character that has special meaning to the command interpreter can be escaped (remove its special meaning) by using the \ character. The following examples should make all of this a bit clearer.
grep -G {grepVar}
This would execute grep in a shell with the value of grepvar as a command line argument.
grep {foo() ? -G : -E}
This would execute grep in a shell. The command line argument would be either -G or -E depending on whether the built-in function foo returned an empty string or not (the empty string would select the second option since it is interpreted as false).
foo(1, {var}); make -k {target} {fnc()}
This would first execute the built-in command foo with arguments 1 and whatever the contents of variable var is. Then make would be run in a shell with argurments -k, contents of variable target and the output of built-in function fnc. Note that fnc would run to completion before make would be started.
make {target1}; make {target 2}
This would first start make in a shell with target set to the contents of target1. Then make would be started in another shell with target set to the contents of target2. Note that the second make would be started without waiting for the first to end. If one wanted the second make to wait for the first to finish the built-in function Shell should be used.
rm {!ls}
This would run the rm command using the output of the ls command as command line arguments (this would delete the contents of the current directory). Note that the ls shell command has to be prefixed with an exclamation mark when used inside of an expansion operator (the {}).
{{var} ? echo(true) : echo(false)}
This would most likely result in a "unknown variable" error. The first element in a decision is expanded so putting an expansion operator on it (as is done above by enclosing var in {}) causes the results of expanding the element to be used as a variable name and that variable to be expanded. Unless there is a variable for the expanded name (not very likely) there will be an error.