I am trying to rewrite several sh-scripts into kotlin scripts. How can I run shell commands or execute binaries accessible in the PATH variable from a kotlin script?
A shell script is using the JVM (java virtual machine) to execute. Which means you can access the inner workings of this by using Runtime.getRuntime()
.
The most notable af the return is the exec
-method
This class has been present since java version 1.0, but here is the javadocs for java 11: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Runtime.html