The name is not intended to sound cute: it means "array okay".
Note that this also demonstrates the need for a silent check: `aok foo' will
fail, but will output an error.
It should not, by convention, be used by any test cases; its opening here
will (presumably, at least) prevent the shell from automatically allocating
it for any file operations and subshells.
This is unfortunately one of the cleanest ways to implement this, since
stdout is piped to stdin of the handler; I did not want to rely on using a
file descriptor, because then you have to deal with issues of rewinding the
pointer for possible future uses, and other considerations.
This allows the implementation to vary in the number of arguments provided
to the expectation handlers without breaking BC so long as the meanings of
the shifted arguments do not change.
My original prototype was more feature-rich than this, but this formalizes
it and provides self-tests.
It is indeed odd seeing shell code that does not look like shell.