Failed to commit this before.
This is all I'll need for scripting some tests for the shell. Should move this code to a shell-specific test.