Execute source command from Java

后端 未结 1 1816
说谎
说谎 2021-01-16 01:06

I am having a bash script file which I am calling using the source command in a shell and is setting a number of environment variables. Then I can use all the tools the envi

相关标签:
1条回答
  • 2021-01-16 01:51
    Process pr = new ProcessBuilder("/bin/bash", "-c", ". env.sh; " + command).start();
    

    Try something like this, where you both source the script and execute a subsequent command in the same shell process. Effectively you source the script every time you want to execute a command.

    0 讨论(0)
提交回复
热议问题