General discussion

Locked

calling a C program in a shell script

By iyerharini ·
hi how can i call a C program in a bourne shell script please let me know

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by Gary_W In reply to calling a C program in a ...

echo "about to call a C program"
cprogram
echo "after calling a C program"

This assumes cprogram is in the $PATH. You may have to specify the path:
/home/username/bin/cprogram

Collapse -

by Nico Baggus In reply to calling a C program in a ...

You might need to compile your cprogram.c first to a binary to be able to run it.

depending on your environment it might be as simple as:

cc cprogram.c -o cprogram

or gcc in stead of cc.

If it is a tad more complex there might be a make file with your cprogram project.

then

make


in the right directory might just work and build everything for you.
(If you make the cprogram yourself, than you also need to make the Makefile yourself.

Kind regards
Nico Baggus

Back to Linux Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums