mikeizbicki / ucr-cs100

open source software construction course
Other
485 stars 407 forks source link

Automating script command #1554

Closed avere001 closed 9 years ago

avere001 commented 9 years ago

Has anybody figured out how to automate script? It's rather tedious restarting every time I think of a new test case.

srufe001 commented 9 years ago

I'm working on this problem as well, the best I have come up with so far is to temporarily include a line in your rshell that prints each command it gets (with a newline). Then, run script, cd into the rshell repository, and run a bash script that looks like this:

#!/bin/bash
cmds="ls | grep bin
echo heooo | sed s_oo_ll_
some other command you want to run
exit"
echo "$cmds" | bin/rshell

script will still be running after this so you'll have to exit to end it. I'm still looking for a more elegant solution but this should work.

EDIT: this leaves 3 processes open for some reason, but subsequent uses don't add to this number, so I think it's still ok to use. EDIT2: nevermind, those processes come from running cs100