SHC stands for Generic shell script compiler. Created by Francisco Javier Rosales García, shc creates a stripped binary executable version of the script specified with -f on the command line. The binary version will get a .x extension appended and will usually be a bit larger in size than the original ascii code. Generated C source code is saved in a file with the extension .x.c .
In a simple word, SHC compile your Bash script into binary so no one can see your code.
And here’s step by step how to install SHC (I use Ubuntu 12.04 LTS) :
- Download the latest version of SHC at here 
- Put the package at your home (~) directory 
- Extract the tarball : - 1 
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13- adee@thinkpad:~$ tar -xzvf shc-3.8.9.tgz 
 shc-3.8.9/CHANGES
 shc-3.8.9/Copying
 shc-3.8.9/match
 shc-3.8.9/pru.sh
 shc-3.8.9/shc-3.8.9.c
 shc-3.8.9/shc.1
 shc-3.8.9/shc.README
 shc-3.8.9/shc.html
 shc-3.8.9/test.bash
 shc-3.8.9/test.csh
 shc-3.8.9/test.ksh
 shc-3.8.9/makefile
- Step inside into the shc folder and do the ‘make’ command : - 1 
 2
 3- adee@thinkpad:~$ cd shc-3.8.9/ 
 adee@thinkpad:~/shc-3.8.9$ make
 make: *** No rule to make target `shc.c', needed by `shc'. Stop.
- As you see above, there’s an error about missing file named ‘shc.c’ Actually the ‘shc.c’ is already there, we just have to rename / duplicate it into the right name : - 1 
 2
 3
 4
 5- adee@thinkpad:~/shc-3.8.9$ cp shc-3.8.9.c shc.c 
 adee@thinkpad:~/shc-3.8.9$ make
 cc -Wall shc.c -o shc
 *** �Do you want to probe shc with a test script?
 *** Please try... make test
- Ok, then we shall continue to ‘make install’ command (need sudo): - 1 
 2
 3
 4
 5
 6
 7- adee@thinkpad:~/shc-3.8.9$ sudo make install 
 *** Installing shc and shc.1 on /usr/local
 *** �Do you want to continue? y
 install -c -s shc /usr/local/bin/
 install -c -m 644 shc.1 /usr/local/man/man1/
 install: target `/usr/local/man/man1/' is not a directory: No such file or directory
 make: *** [install] Error
- Something sucks occurs again. It’s looks like there’s no such directory named ‘/usr/local/man/man1/‘. So what should we do? Simple, just create that folder and repeat again the make install command. It should works now! - 1 
 2
 3
 4
 5
 6- adee@thinkpad:~/shc-3.8.9$ sudo mkdir /usr/local/man/man1 
 adee@thinkpad:~/shc-3.8.9$ sudo make install
 *** Installing shc and shc.1 on /usr/local
 *** �Do you want to continue? y
 install -c -s shc /usr/local/bin/
 install -c -m 644 shc.1 /usr/local/man/man1/
- Next, we have to move the shc binary file into /bin and give it the excecutable bit : - 1 
 2- adee@thinkpad:~/shc-3.8.9$ sudo cp shc /bin/shc 
 adee@thinkpad:~/shc-3.8.9$ sudo chmod +x /bin/shc
- OK Done! SHC is installed into your system. To test it, try type ‘shc’ at the terminal, and it should looks like this : - 1 
 2- adee@thinkpad:~/shc-3.8.9$ shc 
 shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script
OK on the next few days, i will write an article about the usage of SHC. So stay tuned :-)
Posted by Adi Riswan