I have to write a shell that can run pipes. For example commands like ls -l | wc -l
\". I have successfully parsed the command given by the user as below:
Well, a simple and efficient work arund for something like this is making a script with the pipe stuff and then calling the script with some exec command from your C code.
script.sh
#!/bin/sh
ls -l | wc -l
And the you just do in your C program something like this
char *argv[] = {"script.sh", NULL};
execv(argv[0], argv);
Note that you'll have to have the script.sh in the same directory of your C program.