:)In comp.unix.shell on Mon, 25 Jan 1999 00:10:05 +0100,
:)> > i'm looking for a shell code compiler
:)> > capable of converting shell scripts to C code.
:)> Such a program would be hard to write. Shell scripts call external programs
:)> all the time, and how could the translator possibly know what they do?
Such program does exist. It is called shc.c, it is written by
e-mail to the author. I have been using it for long time.
It does not actually convert shell commands to system calls. It
actually compress the shell script and includes it as a part
of C code and compiles the C code built from the template (part of
shc.c). When you execute the compiled code, it will uncompresses
the shell script on the fly and execute it. Once you compile the
program on one can see what commands are executed, not even with
static char *abstract = "Abstract:
This tool obtains a striped binary executable version of the script
specified at command line.
Binary version will be named with .x extension, and will usually be
shorter than ascii one.
You can specify expiration date [-e] too, after which binary will
refuse to be executed, displaying \"Contact with [-m]\" instead.
You can compile whatever interpreted script, but valid [-i], [-x]
and [-l] options must be given.
static char *usage =
"Usage: -f script [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-vCAh]";
static char *help = "
-e %s Expiration date in mm/dd/yy format [NO]
-m %s e-Mail address to contact with at expiration [your provider]
-f %s File name of the script to compile
-i %s Inline option for this interpreter i.e: -e
-l %s Last option i.e: --
The version I have (2.4) supports following languages;
perl, rc, sh, bash, bsh, Rsh, ksh, tsh, ash, csh, tcsh.
more shells are easy to add.
:) such programs do exist... but as you may imagine, i ask
:) as i haven't came across any lately...
:)> Yes, granted, the translator could use system(3) calls to execute these
:)> shell commands untranslated, but what would be the use?
:)from my point of view, i wish to translate some rather
:)simple shell scripts to help learn C (amongst other things)
:)Darren Wyn Rees The Welsh Verb Emporium
Hemant Shah /-------------------\ ^~~~~^
|No place for wimps | o|-OO-|o
TO REPLY, REMOVE NoJunkMail | -Dilbert |--- | () |
FROM MY E-MAIL ADDRESS. \-------------------/ | |
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.