Thursday, July 28, 2011

How to make executable file from a shell script file

To create a executable from a shell script file you should have shell compiler installed in your machine.

first of all download it from the following link.
http://www.datsi.fi.upm.es/~frosal/

you should get the following archive.
shc-3.8.7.tgz

then install it as follows,
1.extract the shc-3.8.7.tgz archive

2.open up a terminal and type

$sudo mkdir -p /usr/local/man/man1

this will require your password.

3.In terminal go to the extracted location (inside shc-3.8.7 directory) and type,

$sudo make install

this should insatall shc in your machine.

To make sure shell compiler is properly installed,type the following

$shc

this should print something like this,
shc parse(-f): No source file specified

shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script


To create a executable,
in terminal go to the location of the shell script and type
$shc -v -r -T -f myshell.sh

this will create a C file as well as executable file for you.

To refer the manual of shc please visit the following link.

1 comment:

  1. nicely done.thanx

    After i run "shc -v -r -T -f myshell.sh "
    it create two files in that location]Those files not looks like excutabale :-( ].

    For make them looks like excutable.
    Give chmod permission to test.sh.x(newly crated file after above command)

    Then you can see the excutable.

    cheers
    kwak

    ReplyDelete