I'm trying to run a set of shell commands using the Scala process builder. In Scala, I run the process builder like this:
val command : String = ... // loaded from file somewhere
val processBuilder = Process(command)
val exitCode : Integer = processBuilder.!
the commands are (ran one by one):
/usr/bin/R --slave --silent --file=test.R argval1 >> out
/usr/bin/R --slave --silent --file=test.R argval2 >> out
/usr/bin/R --slave --silent --file=test.R argval3 >> out
These three shell commands above will work without exceptions but the out file is never created. Then the following final command fails:
awk 'n < $0 {n=$0}END{print n}' out > final
basically it picks the smallest element of file out and puts it in file final. The awk command will fail with the following error while running it in command line works fine:
awk: syntax error at source line 1
context is
>>> ' <<<
awk: bailing out at source line 1