You can instead try using the popen command instead of system command. This allows you to either have a pipe as input to the process or a pipe as output from the process.
I have a quick and dirty Sketch that allows me to do one line commands from an Arduino terminal window and have the results piped back that I display in the terminal window.
The code for it is in the thread: