Calling shell script from a C program
hi,
im COMPLETELY new to linux. using it for the first time. i need to learn how to call a shell script from a c program. the script im using is #!/bin/bash # first script who am i date pwd how do i call it in a c program using 'system'. Thanks. |
Quote:
|
Im asking what arguments system() takes? im providing the path of the script file but it doesnt work.
the shell script runs fine. the c program compiles. but when i run it it gives me error sh:1 home/user/documents/firstshell.sh not found. Could you guide me where i could be wrong? |
Thanks, it was just a syntax error :)
|
I'm guessing that you forgot the leading slash before "home" -- am I right?
Note that if you want to be able to actually use the output of the script in the program, you'll need to use something like popen to do so. |
All times are GMT -5. The time now is 03:55 AM. |