Skip to content

Instantly share code, notes, and snippets.

@MnifR
Created April 20, 2021 12:40
Show Gist options
  • Save MnifR/6862ed8b86907e841788ae1602a62868 to your computer and use it in GitHub Desktop.
Save MnifR/6862ed8b86907e841788ae1602a62868 to your computer and use it in GitHub Desktop.

Shc takes a script, which is specified on the command line and produces C source code. The generated source code is then compiled and linked to produce a stripped binary executable.

The compiled binary will still be dependent on the shell specified in the first line of the shell code (i.e shebang) (i.e. #!/bin/sh)

user@hostname:~$ sudo vim script.sh
user@hostname:~$ sudo chmod +x script.sh
user@hostname:~$ sudo add-apt-repository ppa:neurobin/ppa
user@hostname:~$ sudo apt-get update
user@hostname:~$ sudo apt-get install shc
user@hostname:~$ shc -f script.sh -o /usr/local/bin/script
user@hostname:~$ file /usr/local/bin/script

https://github.com/neurobin/shc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment