Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to gunzip a binary on the fly



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.
> 
> 
> 
> 
> 





Messages sorted by: Reverse Date, Date, Thread, Author