Executing unix command in java using semicolon
Posted on 2008-06-23
I want to execute 2 commands in one go, in unix this works like this:
ll ; cd ..
But when I call unix from out of java :
Process p = Runtime.getRuntime().exec("ll ; cd ..");
It threads the ; not as a delimiter for the previous command, but just like a character.
this results in ll semicolon, which gives of course the error message:
"; not found"
instead of executing ll and then cd ..