I'm new in Cprogramming and have this problem. I want to run my program like ./my_program command1 [args] command2[args] command3 [args]
for example ./my_program /bin/ps -ef /bin/grep "pattern" /bin/wc -l
and I need to know in my main function which argument in argv array is command and which is argument of this command.
so in my example /bin/ps, /bin/grep and /bin/wc is commands and -ef, "pattern", -l is their arguments.
Output of the first command with arguments is input of the second command and output of second command is input of third command.
Commands arguments are alternative.
I must compare arguments of main function that beggins with '/'? or is there some better function to detect which argument is extern shell command?
Thank's all for help.