As reported here Execute external command in order to run an external shell command or script in Scala the right code should be:
import scala.sys.process._
val cmd = "ls -l /home" // Your command
val output = cmd.!! // Captures the output
I've noticed this works for some commands but not for others like "java -version"
(especially if they have dash "-"
before arguments)
Is there a correct way to execute commands like "python --version"
or a more complex python script like "python /path/to/my_script.py -x value -y value"
?