You need a third fork to run the echo() and grep() suimutaneously. With your code, you will hang on the waitpid() in the echo().

-Erik