I am writing a program in C that bash code as well. I need to assign the value of a C variable to a bash variable. More specifically I need to assign the argument supplied to C program to bash variable inside same program.
int main( int argc, char **argv)
{
printf(argv[1]);
system("echo $1"); // Here I need to assign argv[1] to bash variable.
}