The fork and the exec calls are going to be your friends here.
I did a problem like the one you describe when I was in college and I used lex and yacc to build a command parsing system. That way I was able to easily implement shell commands in a nice easy to understand manner. It also helped me implement tab completion when all was said and done, if that is something your interested in.
Since it's a school project I won't send you my source code, but if you have any specific questions about anything in particular don't hesitate to ask.
|