Make a seperate executable ver. of a shell script

Make a seperate executable ver. of a shell script

Post by Atiqullah Hash » Fri, 18 Oct 1991 02:03:37



A shell script is not compiled and linked so we can't have an exec.
version of it as we have in a programming lang. . Is there a way that
after writing a (bourne ) shell script we make it executable and just
give the executable version to somebody (making a script executable by
chmod does not make a seperate exec. version and to give somebody you
have to give the script itself).


 
 
 

Make a seperate executable ver. of a shell script

Post by Andrew M. Du » Sun, 20 Oct 1991 04:44:42



>A shell script is not compiled and linked so we can't have an exec.
>version of it as we have in a programming lang. . Is there a way that
>after writing a (bourne ) shell script we make it executable and just
>give the executable version to somebody (making a script executable by
>chmod does not make a seperate exec. version and to give somebody you
>have to give the script itself).

Why do you want to do this?  I can think of two reasons...

(1) For security (you don't want them having the source to your script)

    Easy enough.  Make a C program which has the script text as data.
    Use Popen() to exec a copy of the shell, with an input pipe to
    it.  Stuff the script text into the pipe and watch what comes out.
    Or write stuff to a temp file, fork(), exec(/bin/sh,tmpfile),
    then when /bin/sh terminates, erase the file.

(2) For completeness (in case they don't have /bin/sh)

    who doesn't have at least /bin/sh?????

I'd guess you're more concerned about (1) than (2).

Andy
--
:-------------------------------------------------------------------------:

:  "Life is what we make of it, but we have to make up our mind first!"   :
:-------------------------------------------------------------------------:

 
 
 

Make a seperate executable ver. of a shell script

Post by Mike O'Conn » Mon, 21 Oct 1991 03:43:20


Does a PD shellscript compiler exist?

 Mike O'Connor                       | "Detroit:  Where the weak are killed and
 NIC Database:  MJO17                | eaten"

 UUCP:  ...!ttardis!mjo              | -Detroit Mayor Coleman Young

 
 
 

1. Executable Binary File vs. Executable Script File

Hi,

I need to write a simple script to "strip off" all the binary files in a
certain directory that contains some sort of executable script files,
i.e. perl, shell, tcl, etc.  I tried the following script that I named
"/tmp/junk":

        #!/bin/sh
        for ff in `find . -type f`
        do
                ! test -r $ff || strip $ff
        done

and it did stripped off the executable binary files as well as giving me
some error messages saying "File format not recognized" when it tried to
strip off the script files.  The question is: How to modify the above
script that will by pass the stripping process if the file is not really
an executable binary file?

Can anyone please help?  TIA.

--

PS> Remove the "4" from e-mail address to respond.

2. PC-NFS and Solaris 2.3

3. "Cannot open" error on executable shell script

4. Does FreeBSD support Win95 long file names?

5. setting root SUID for an executable shell script

6. RH 8.0, SMB, and CUPS, printing problems

7. Shell script to find executable files

8. File system corruption with WD AC33100H

9. self decrypting shell scripts (executable / not reable)

10. Passing SIGINT to an executable from a C-shell script

11. setting root SUID for an executable shell script

12. Is there a way to convert a shell script into an executable binary program?

13. handling SIGINT in shell scripts when executing another shell script.