Compiling and installing your own Bash shell
In this recipe, we are going to learn about compile and install the Bash shell. We are going to use SHC, which is shell script compiler.
Getting ready
Besides having a terminal open, make sure you have SHC installed in your system.
How to do it...
Now we will write a simple shell script that will print “Hello World”
. Using SHC, the Shell script will be converted into binaries directly. Create a script hello.sh
, and write the following content in it.
#!/bin/bash echo "Hello World" a=10 b=20 c=$((a+b)) echo $c
Now, to log all commands, run the logger
command as follows:
$ logger -f hello.sh
How it works...
After executing the script, two extra files will be created. The files are:
hello.sh.x
: This file is the stripped binary encrypted shell script in binary formathello.sh.x.c
: This file is the C source code ofhello.sh
Now, execute the encrypted shell script as follows:
$ ./hello.sh.x
The logger command will make an entry about your file in the syslog file...