How can I execute a shell script from C in Linux?
You can use system:
system
system("/usr/local/bin/foo.sh");
This will block while executing it using sh -c, then return the status code.
sh -c