Hi all,

Pardon the newb question, but is there any command for that will exec()
a command passed in on the command line $n times? I'm thinking of something like:

for (int i = 0; i < 10; i++) {
   pid = fork ();        /* Run CMD as child process.  */
   if (pid < 0)
       exit();
   else if (pid == 0) {
       execvp (cmd[0], cmd);
       error (0, errno, "cannot run %s", cmd[0]);
       _exit (errno == ENOENT ? 127 : 126);
   }
}

if (pid != 0)
   for (int i = 0; i < 10; i++)
       wait(NULL);




_______________________________________________
gnu-misc-discuss mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnu-misc-discuss

Reply via email to