zsh-users
 help / color / mirror / code / Atom feed
* How to gunzip a binary on the fly
@ 1996-12-27 15:01 Helmut Jarausch
  1996-12-27 15:52 ` Marc Baudoin
  1996-12-27 19:09 ` Szekeres Istvan
  0 siblings, 2 replies; 4+ messages in thread
From: Helmut Jarausch @ 1996-12-27 15:01 UTC (permalink / raw)
  To: zsh-users


Hello,
does anybody know how to gunzip a gzipped binary file just for executing it.
Is it possible to do so without an intermediate file - just piping it
into the shell.

Assume there is a file  doit.gz

I would like a function  exec_gz  and invoke doit by  exec_gz doit.gz
without

gunzip -c doit.gz >/tmp/doit
/tmp/doit
rm /tmp/doit


Thanks for any hints,

a Happy New Year to all of you,

Helmut Jarausch.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to gunzip a binary on the fly
  1996-12-27 15:01 How to gunzip a binary on the fly Helmut Jarausch
@ 1996-12-27 15:52 ` Marc Baudoin
  1996-12-27 19:09 ` Szekeres Istvan
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Baudoin @ 1996-12-27 15:52 UTC (permalink / raw)
  To: Helmut Jarausch; +Cc: zsh-users

Helmut Jarausch <jarausch@igpm.rwth-aachen.de> écrit :
> 
> does anybody know how to gunzip a gzipped binary file just for executing
> it.

Did you try gzexe (comes standard with gzip)?  Its man page says:

[...]

NAME
       gzexe - compress executable files in place

DESCRIPTION
       The  gzexe  utility  allows you to compress executables in
       place and have them automatically uncompress  and  execute
       when  you  run  them  (at  a penalty in performance).  For
       example if you execute ``gzexe /bin/cat'' it  will  create
       the following two files:
           -r-xr-xr-x  1 root  bin   9644 Feb 11 11:16 /bin/cat
           -r-xr-xr-x  1 bin   bin  24576 Nov 23 13:21 /bin/cat~
       /bin/cat~  is  the original file and /bin/cat is the self-
       uncompressing executable file.  You can  remove  /bin/cat~
       once you are sure that /bin/cat works properly.

       This  utility  is  most  useful on systems with very small
       disks.

[...]

-- 
Marc Baudoin   -=-   <Marc.Baudoin@hsc.fr>
Hervé Schauer Consultants


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to gunzip a binary on the fly
  1996-12-27 15:01 How to gunzip a binary on the fly Helmut Jarausch
  1996-12-27 15:52 ` Marc Baudoin
@ 1996-12-27 19:09 ` Szekeres Istvan
  1996-12-27 20:03   ` Zoltan Hidvegi
  1 sibling, 1 reply; 4+ messages in thread
From: Szekeres Istvan @ 1996-12-27 19:09 UTC (permalink / raw)
  To: zsh-users; +Cc: Helmut Jarausch


If you mean the gzipped file is a shell script then it's pretty easy:

exec_gz () {
        eval "$(gunzip -c $1)"
}

so you can do

exec_gz myscript.gz

In case the gzipped file is a binary (read: the file _before_ gzipping is a
binary) I think there is no way to do this. The OS (at least a few unices,
e.g. linux) needs the executable to be present as a file on a filesystem.


Pista

ps: Maybe the shell creates a temp file or pipe for the output of gunzip, I
can't check it right now.


> Hello,
> does anybody know how to gunzip a gzipped binary file just for executing it.
> Is it possible to do so without an intermediate file - just piping it
> into the shell.
> 
> Assume there is a file  doit.gz
> 
> I would like a function  exec_gz  and invoke doit by  exec_gz doit.gz
> without
> 
> gunzip -c doit.gz >/tmp/doit
> /tmp/doit
> rm /tmp/doit
> 
> 
> Thanks for any hints,
> 
> a Happy New Year to all of you,
> 
> Helmut Jarausch.
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to gunzip a binary on the fly
  1996-12-27 19:09 ` Szekeres Istvan
@ 1996-12-27 20:03   ` Zoltan Hidvegi
  0 siblings, 0 replies; 4+ messages in thread
From: Zoltan Hidvegi @ 1996-12-27 20:03 UTC (permalink / raw)
  To: szekeres; +Cc: zsh-users, jarausch

Istvan Szekeres wrote:
[...]
>         eval "$(gunzip -c $1)"
[...]
> ps: Maybe the shell creates a temp file or pipe for the output of gunzip, I
> can't check it right now.

No it doesn't.

Zoltan


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-12-28  0:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-27 15:01 How to gunzip a binary on the fly Helmut Jarausch
1996-12-27 15:52 ` Marc Baudoin
1996-12-27 19:09 ` Szekeres Istvan
1996-12-27 20:03   ` Zoltan Hidvegi

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).