I have a directory of folders, each containing a number of .class (Java) files. I would like to write a script to run each one and test it on a number of given inputs.
In otherwords, when I normally type "java myClass" in one of the folders, a console menu will appear and ask for some input. I might choose option "1" and hit enter; then it will ask me, say, what my name is - I'll type in my name, and it will bring the menu back up; and so on and so forth.
I can probably figure out how to traverse all the folders (I just began scripting today), but I can't seem to figure out how to run the test cases on the java files. I tried scripts as simple as these:
echo -e "1\nBlueRaja" | java myClass
(echo 1; echo BlueRaja) | java myClass
and more complex code (using a named pipe) like this:
java myClass <pipe >output.out &
echo -e "a\n" > pipe
echo -e "BlueRaja\n" > pipe
However, nothing seems to work. If anyone could lend me some of their insight, it would be greatly appreciated.