Execute binary directly from curl

Is there a bash command to execute a binary "stream"? There is a good way to download and run shell scripts directly from the Internet.

as an example:

curl http://j.mp/spf13-vim3 -L -o - | sh

Is it possible to run binary files without saving the file, chmod, etc.?

sort of:

curl http://example.com/compiled_file | exec_binary
+5
source share
1 answer

The Unix kernel that I know expects binary executables to be stored on disk. This is necessary so that they can perform search operations with arbitrary offsets, as well as display the contents of the file in memory. Therefore, direct execution of a binary stream from standard input is not possible.

, , script, , , .

#!/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.$$
+9

All Articles