Today we will create binary file before compiling it into an RPM package. I had wrote a find script which is basically doing the same thing as find command in addition, you can give to the script exact date, hour, second to search. Imagine that you have 3.000 files in a directory, you are asked to delete files between 20/02/2016 at 08:00:00 and 05/08/2017 till 16:25:00. To do that you have to create reference files with touch –t command. Otherwise, -mmin or  –mtime may miss some files or delete important files which is not welcomed in real work environment. My script can list files, delete, compress, create a tar ball and move it to desired location, change or delete extensions. These operations can be done by searching files with name or given time interval.

SHC is a tool that we are looking for. First, let’s download and install it:

Go inside SHC directory and type make, after that you will be able to execute the script by ./shc

Where –f is your script as a file

Then under your script’s directory which is f /root/Downloads you will see newly create .sh.x and .sh.x.c files.

.sh.x is the encrypted shell script in binary format

.sh.x.c is the C source code of the random.sh file. The logic behind it is shc converts shell script to a C program find_script.sh.x.c has been generated. Then C file is compiled, find_script.sh.x executable is created.

As you see, find_script.sh.x is henceforth a 64 bit executable.

Shc options:

-e : specify expiration date. If used, a message will be printed while executing the script.


./script.sh.x: has expired!

Please contact your provider

-m option is for message. While printing a warning message you can print whatever you want.

-T option will allow the created binary files to be traceable using programs like strace, ltrace, etc.

-v is for verbose.

Now, let’s run our program.

Script is in French language with multiple options I just wanted to show menus and how it looks the binary file.

You can download the script from here, if you want to check.

Read more: Create RPM Packages