LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Asking a C program to call a bash script (https://www.linuxquestions.org/questions/programming-9/asking-a-c-program-to-call-a-bash-script-347583/)

sceadu 07-28-2005 04:49 AM

Asking a C program to call a bash script
 
Hmm....I have never done this before.

Can I code a C program to run a script when certain condition occurs?
If yes, can someone kindly post an example.

Many thanks in advance.

Mega Man X 07-28-2005 05:26 AM

Doesn't "system" do that?

Code:

#include <stdlib.h>

int runSomething;

runSomething = system ( ls );
...

this is just a guess and clearly won't compile either :D

vharishankar 07-28-2005 06:01 AM

That should be
Code:

int returnvalue = system ("ls");
Argument is a const char *

;)

Mega Man X 07-28-2005 07:37 PM

Ah, thanks Harishankar :)

sceadu 07-28-2005 08:52 PM

thanks :D


All times are GMT -5. The time now is 02:39 PM.