i have a simple program on sun box:
the output i get shows only the date and does not execute the pwd command. why does this happen? how can i resolve it?Code:int main() { execl("/usr/bin/date","date","0"); execl("/usr/bin/pwd","pwd","0"); }
i have a simple program on sun box:
the output i get shows only the date and does not execute the pwd command. why does this happen? how can i resolve it?Code:int main() { execl("/usr/bin/date","date","0"); execl("/usr/bin/pwd","pwd","0"); }
Because execl() doesn't return - which is explained in the manual page.
so what should I do so that I can get both those commands going?
Look up fork() and wait()
Or read some examples of such functions on the Linux board.
In very minimal pseudo-code, it's
if ( fork() == 0 ) execl() else wait()