I'm having problem running the UNIX "grep" command from
java.
This is what my code looks like:
When I ran the "grep" command above, it return exit code=1, which means no match found.
When I replace the "grep" command with "ls", it works fine. When I replace the "grep" command with "wc -l", first it returns zero but when I added a empty loop to delay the parent program, I got the right value.
I use waitFor() method, but I think it does not work well.
Can someone please help me or tell my why "grep" command does not work from Java?