0
 proc = Runtime.getRuntime().exec(new String[]{"ls"});

Using code above we can launch ls, we can pass arguments. But how to launch something like this:

ls | egrep "init|sys"

About 'Duplicate': Unfortunately original question solution doesn't work for me. Exception:

Error running exec(). Command: [/bin/sh, -c, logcat | grep something] Working Directory: null Environment: null
user64675
  • 482
  • 7
  • 25
  • Possible duplicate of [How to make pipes work with Runtime.exec()?](http://stackoverflow.com/questions/5928225/how-to-make-pipes-work-with-runtime-exec) – Doug Stevenson Mar 29 '16 at 00:51
  • Unfortunately original question solution doesn't work for me. Exception: Error running exec(). Command: [/bin/sh, -c, logcat | grep something] Working Directory: null Environment: null – user64675 Mar 29 '16 at 01:02

0 Answers0