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
De-compressing curl output Binary output may be the result of HTTP compression which is often used to save bandwidth and speed-up transmission.
Grab file with curl run: $ curl https://your-domain/file.pdf. Get file using ftp or sftp protocol: $ curl ftp://ftp-your-domain-name/file.tar.gz. You can set the output file name while downloading file with the curl, execute: $ curl -o file.
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.$$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With