execute binary directly from curl execute binary directly from curl curl curl

execute binary directly from curl


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 terminatestrap 'rm -f "/tmp/exec.$$"' 0trap 'exit $?' 1 2 3 15# Create temporary file from the standard inputcat >/tmp/exec.$$# Make the temporary file executablechmod +x /tmp/exec.$$# Execute the temporary file/tmp/exec.$$