Hello! I have created a small program in c languge.This program creates some child procceses in with the fork() function.The amount of the procceses that are created is given as the first argument of the console. I would like someone to help me convert this program from c to bash script.
/* The first argument is the amount of the procceses to be created*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
main(int argc, char **argv)
{
int pid,i;
int pnumber;
pnumber=atoi(argv[1]);//Converting the first arg to int so i can put in for loop
for(i=1;i<=pnumber;i++){
pid=fork();// Creating the child procceses with fork
if(pid!=0) { //The child procces prints its id and then exit
printf("The id the created proccess is:%d and it is a child proccess \n",pid);
printf("RETURN\n");
exit(1);
}
}
}