I’m not sure what to tag this with, but I need help combining two commands into a single command. I’ve tried this with ant, but it doesn’t perform as required (long story). Essentially I need
javac *.java
java org.junit.runner.JUnitCore filename
To be consolodated into a single command. Preferrably something like
ant
with an external build.xml file, however after several hours fiddling with Ant I’ve gotten it to work but not as required (I need continuous output to stdout during runtime). I’m fine with shell scripts, clever java tricks, anything. I’ll take what I can get at this point.
Writing a shell script is really a trivial matter: just copy-paste those exact two lines into a file (say you call it
myscript.sh) and you’re done. Then you can run it withsh myscript.sh. For added convenience add a first line that says#!/bin/sh(the so-called “hash-bang” incantation), issue achmod u+x myscript.sh, and then you can run it as any other command:./myscript.sh.BTW this turned out into a question unrelated to Java, you might retag it with a shell script-related tag.