LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   shell scripts ...--can it be called with in a c program (https://www.linuxquestions.org/questions/linux-newbie-8/shell-scripts-can-it-be-called-with-in-a-c-program-474707/)

narendra.pant 08-17-2006 05:54 AM

shell scripts ...--can it be called with in a c program
 
mates ia hav a problem
---

-- can i call a shell script from a c program ?

w3bd3vil 08-17-2006 06:05 AM

sure you can, there is a function called system(). Searh for it.
you could probably do this system("sh shellscript.sh");
what system does is execute the command as your terminal.

mkirc 08-17-2006 07:43 AM

Certainly you can as described above with "system" call !
Be aware that a separate task is opened from the OS with all overhead required, so this might work out for calls that are not performance critical !


All times are GMT -5. The time now is 08:55 PM.