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)?
Answer
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.
Related Questions
- → OctoberCMS Backend Loging Hash Error
- → "failed to open stream" error when executing "migrate:make"
- → OctoberCMS - How to make collapsible list default to active only on non-mobile
- → Create plugin that makes objects from model in back-end
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → How to install console for plugin development in October CMS
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → How to update data attribute on Ajax complete
- → October CMS - Conditionally Load a Different Page