Try running the shell command with JAVA’s stdin/stdout capability.
It’s much more flexible than the shell object as you’ll be able to do
what you want with the results and potentially pipe them into another
process. To do this, you just need to make a simple mxj.