execute binary directly from curl

bash, binary, curl, executable

Solution

The Unix kernels I know expect binary executable files to be stored on disk. This is required so they can perform seek operations to arbitrary offsets, and also map the file contents into memory. Therefore, directly executing a binary stream from the standard input is not possible.

The best you can do is to write a script that will indirectly accomplish what you want, by saving the data into a temporary file.

#!/bin/sh

# Arrange for the temporary file to be deleted when the script terminates
trap 'rm -f "/tmp/exec.$$"' 0
trap 'exit $?' 1 2 3 15

# Create temporary file from the standard input
cat >/tmp/exec.$$

# Make the temporary file executable
chmod +x /tmp/exec.$$

# Execute the temporary file
/tmp/exec.$$

Problem

Is there a bash command to execute a binary-"stream"? There is a nice way to load and run shell scripts directly from the internet. as example: ``` curl http://j.mp/spf13-vim3 -L -o - | sh ``` Is it possible to run binaries without saving the file, chmod etc. ? something like: ``` curl http://example.com/compiled_file | exec_binary ```

Original source