could anyone point me towards a tutorial that show me how to embed bash shell commands in c. i know it can be done in perl but my assingment is in c. I've tried google but after an hour of sifting thru it i've come up with nothing.
thanks,
Dave
could anyone point me towards a tutorial that show me how to embed bash shell commands in c. i know it can be done in perl but my assingment is in c. I've tried google but after an hour of sifting thru it i've come up with nothing.
thanks,
Dave
Last edited by docetes; 03-16-2006 at 06:35 AM.
found an example
Code:#include <stdio.h> #include <stdlib.h> #define SHELLSCRIPT "\ for ((i=0 ; i < 10 ; i++))\n\ do\n\ echo \"Count: $i\"\n\ done\n\ " int main() { puts("Will execute sh with the following script :"); puts(SHELLSCRIPT); puts("Starting now:"); system(SHELLSCRIPT); return 0; }