#include #include int main(void) { pid_t pid; int status; char *args[4]; /* * Create a child process. */ if ((pid = fork()) < 0) { perror("fork"); exit(1); } if (pid == 0) { /* * This code executes in the child process * (fork returned zero). */ execl("/bin/echo", "echo", "Today's date is:", NULL); /* * If the exec succeeds, we'll never get here. */ perror("exec"); exit(1); } /* * Wait for the child process to complete. We * don't care about the termination status. */ while (wait(&status) != pid) continue; /* * This code executes in the parent process. */ execl("/bin/date", "date", "+%m/%d/%y", NULL); /* * If the exec succeeds, we'll never get here. */ perror("exec"); exit(1); }