proc = Runtime.getRuntime().exec(new String[]{"ls"});
Using the code above, you can run ls, you can also start the process with arguments. But how to run something like this?
ls | egrep "init|sys"
This is clearly not going to work:
proc = Runtime.getRuntime().exec(new String[]{"ls","|","egrep","\"init|sys\""});
sh -c
. - zRrr