bash - Executing shell-script with parameters from java -
I've been googling for a while, and everyone seems to have a different solution, none of which works for me is .
I have tried both Despite the manual running works perfectly with Bash. I need to keep One option is to handle Each other has to allow Bash to handle it for you: process builder and runtime . Call both the .sh file directly and feed it to / bin / bash .
string cmd [] = {"~ / path / to / shellscript.sh", "foo", "bar"}; Process P = RuntimeGreat Time (). Exec (CMD); is not giving any such file or directory
~ / path / to / Shellscript.sh foo Bar ~ because this shell script exists in slightly different forms, three different users. ~ : < Pre> string homdir = System.getenv ("HOME"); String [] cmd = {homeDir + "/path/to/shellscript.sh", "foo", "bar"}; Process P = RuntimeGreat Time (). Exec (CMD);
string [] cmd = {"bash", "-c", "~ / Path /to/shellscript.sh foo bar "}; Process P = RuntimeGreat Time (). Exec (CMD);
Comments
Post a Comment