Bash: How to extract an executable from within?

Patrick O'Callaghan pocallaghan at gmail.com
Tue Sep 15 01:46:05 UTC 2009


On Mon, 2009-09-14 at 17:48 -0700, Daniel B. Thurman wrote:
> outname=selfextractExe.$$
> 
> function unWrapExe() {
> cat <<'EOF'
> <executable>
> EOF
> }
> 
> # Do pre-shell stuff
> 
> unWrapExe > $outname
> ./outname

A few comments on this (I realize it's only a sketch of the code):

1) Why declare a function if it has no argument? Just put the code
inline.
2) You need to make the output file executable ("chmod ...")
3) The executable isn't ./outname, it's $outname

poc




More information about the fedora-list mailing list