In short, howto run a bash compressed script?, but can this be done with a binary, instead of a shell script?
Suppose I have a binary which is compressed into a .gz. I can unzip to a pipe and examine the contents thus:
$ gzip -d --stdout hello.gz | file - /dev/stdin: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not stripped $
Instead of piping this output to a command, is there any way I can actually execute the contents of the pipe itself, without writing it to a file?
I considered using a named pipe, but this doesn't seem to work:
$ mkfifo execpipe $ chmod 777 execpipe $ gzip -d --stdout hello.gz > execpipe & [3] 30034 $ ./execpipe bash: ./execpipe: Permission denied $ [3]+ Broken pipe gzip -d --stdout hello.gz >execpipe $
Is there a way to execute the contents of a pipe without creating an actual file?