How to pass the command line arguments to the shell script in c language?

hi,
I am new in the shell script, and c programming with linux. I am looking to pass the arguments in c program that should be executed by the shell script.

e.g.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{       int i;
        for (i=1;i<argc; i++)
        {
                return system("/bin/migrate argv"); <--- keep attention here
        }
        return 0;
}

here the migrate is shell script taking agrument as "argv[i]" but not actual argument passed to the program.
can anybody help me for this..???
:confused:

First you need to concatenate the arguments to the system command before you pass it on to it for execution...

char command[100];
sprintf(command, "%s %s", "/bin/migrate", argv[1]);
system(command);
1 Like

hello shamrock,
this has been solved much issue.
Thank you, :b:
regards,
Sharlin