[net.sources] converting sh scripts to C code

brunner@sdsioa.UUCP (Rob Brunner X2830) (06/19/86)

Has anyone out there written anything to convert sh scripts to 
C code??  We have quite a few sh scripts around here and they
could run *far*quicker* if converted to C, but before I sit down
and crank them out by hand, I was wondering if anyone else had
encountered this before and had written some sort of something to
do it.

Any help is appreciated, thanks.
-- 
Rob Brunner                              email:
Scripps Institution of Oceanography      brunner@sdsioa.UUCP
Mail Code A-010, UC San Diego            sdsioa!brunner@sdcsvax
San Diego, CA 92093                      {backbone}!sdcsvax!sdsioa!brunner
Phone: (619) 534-2040 (work)             (619) 452-7656 (home)

henry@utzoo.UUCP (Henry Spencer) (06/25/86)

> Has anyone out there written anything to convert sh scripts to 
> C code??  We have quite a few sh scripts around here and they
> could run *far*quicker* if converted to C...

There's at least one such commercial product, although it's probably
not worth the cost if it's only a few scripts.  However...  if you
have a modern shell (the ancient Bourne shell that comes with 4BSD
does not qualify), you may not see all that much improvement.  Once
things like "echo" become builtins, it's not clear that you save
much by avoiding the fork/exec.  Real improvement would come from
having the C program do the things that are done by sed or awk in
shell programs, and *that* conversion would be far more complex.

If you are not running the SVR2 sh or equivalent, you need to upgrade
your shell.  Only after that is accomplished is it worth considering
conversion to C, in my opinion.
-- 
Usenet(n): AT&T scheme to earn
revenue from otherwise-unused	Henry Spencer @ U of Toronto Zoology
late-night phone capacity.	{allegra,ihnp4,decvax,pyramid}!utzoo!henry