0

How to call an executable C in script shell ? I did echo name_of_executable_file but it didnt works

2
  • Sorry, did you compile your C code? How? Or do you want to run an executable from C? Maybe you need system(3) or popen(3). Read also about path_resolution(7), syscalls(2), environ(7), credentials(7) Commented May 12, 2021 at 15:43
  • Never describe a problem only as “it didnt works.” State exactly what you did, what behavior you observed, and what behavior you desire instead. For example, if the shell printed a message like “name_of_executable_file: command not found”, then say that. Commented May 12, 2021 at 15:58

2 Answers 2

2

You call it like this:

/path/to/name_of_executable_file

Or if it's in the current directory, like this:

./name_of_executable_file 
Sign up to request clarification or add additional context in comments.

2 Comments

Or stick it somewhere in the executable path.
Or add the directory of name_of_executable_file to the PATH.
1

use the below,

#!/bin/sh
/path/to/executable arg1 arg2

arg is optional

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.