How to compile a linux shell script to be a standalone executable *binary* (i.e. not just e.g. chmod 755)?

binary, compilation, executable, obfuscation, scripting

Solution

The solution that fully meets my needs would be SHC - a free tool, or CCsh a commercial tool. Both compile shell scripts to C, which then can be compiled using a C compiler.

Links about SHC:

- https://github.com/neurobin/shc

- http://www.datsi.fi.upm.es/~frosal/

- http://www.downloadplex.com/Linux/System-Utilities/Shell-Tools/Download-shc_70414.html

Links about CCsh:

- http://www.comeaucomputing.com/faqs/ccshlit.html

Problem

I'm looking for a free open source tool-set that will compile various "classic" scripting languages, e.g. Korn Shell, ksh, csh, bash etc. as an executable -- and if the script calls other programs or executables, for them to be included in the single executable. Reasons: To obfuscate the code for delivery to a customer so as not to reveal our Intellectual Property - for delivery onto a customer's own machine/systems for which I have no control over what permissions I can set regarding access, so the program file has to be binary whereby the workings cannot be easily seen by viewing in a text editor or `hexdump` viewer. To make a single, simply deployed program for the customer without/or a minimal amount of any external dependencies. I would prefer something simple without the need for package manager since: I can't rely on the customer's knowledge to carry out (un) packaging instructions and I can't rely on the policies governing their machines regarding installing packages (and indeed from third parties). The simplest preferred approach is to be able to compile to proper machine code a single executable that will run out of the box without any dependencies.

Original source