skyuuka
skyuuka

Reputation: 675

c program binary cannot run in sh

I have cross-compiled an executable from c code for an arm-based embedded system. When I execute the binary in the embedded system, it gives the following error:

line 1: syntax error: unexpected word (expecting ")")

I searched around, and figured out it is because the embedded system (some version of Linux) I am using does not have bash but only sh. Is it possible to make my compiled binary executable using sh, without installing bash in it (which is troublesome)?

Upvotes: 0

Views: 109

Answers (1)

m0hithreddy
m0hithreddy

Reputation: 1829

Binaries are not built for the shell program. They are built for a particular architecture and OS environment. All shell does is, fork() a child process and calls exec(). So it won't matter whether your host machine is having bash or sh. Just make sure that binary is for the correct architecture and the machine. And you are indeed executing the binary, not the source.

Upvotes: 3

Related Questions