Randomly-Sequenced Notes

since random notes is better than no documentation

For the most part, I have strived to be as similar to GNU bash as possible. Therefore, the manpage and infopage for bash is suitable for filling in blanks in the documentation, not to mention being useful guides during implementation :).

Parameter Substitution

Parameter substitution includes substitution of positional parameters, variables, command, and some other stuff.

Substitution is initiated by a marker, usually dollar-sign ("$"). Since there's no global consensus on the decimal marker ("." versus ","), there's no reason to dictate dollar-sign as the substitution marker. The characters following the marker indicate the particular type of substitution:

0-9
positional parameter: one digit is read, and used as index of positional parameter to use. Calls to shift are required to access positional parameters past 9.
*
all as one: takes all positional parameters from 1 to end and joins them with spaces. The entire string is enclosed in quotes to create one word.
@
all params: each positional parameter from 1 to end is concatenated. Each separate token becomes its own word (no quoting done).
A-Za-z_
identifier: the string is read up until a non-identifier character is reached. Then the string is taken as the variable name to use.
{
name delimiter: this helps differentiate between $foobar (one variable named "foobar") and ${foo}bar (a variable named "foo", then a constant string "bar"). Terminates at a }.
(
command substitution: substitutes in the output of the command. Terminates on a ).
((
arithmetic substitution: evaluates the content as an arithmetic expression (infix notation), and substitute result. Terminates on a )).