是否有一个简单方式在Scala(或Java)中执行以下操作。我想从Scala进程运行命令行命令,例如:使用通配符运行多个shell命令
cd test && javac *.java
作为一个动态生成的shell脚本。 javac *.java
应该 发生在目录test
。一贯的简约
import scala.sys.process._
...
"cd test && javac *.java".!
或
"cd test && javac *.java".!!
不起作用,因为Scala misinterpretes的&&
和通配符*
。我没有 想法为什么。
谢谢,这使得有很大的意义。同时,我发现相关的问题[这里](http://stackoverflow.com/questions/11790240/how-to-run-unix-shell-commands-with-wildcards-using-java),[这里]( http://stackoverflow.com/questions/2111983/java-runtime-getruntime-exec-wildcards)和[这里](http://stackoverflow.com/questions/11576767/setting-current-working-directory-when-executing -a-shell-process),它们有相似之处。我认为Scala文档在这个问题上可能会更好。 –