Q:

Possible to create burn-after-execute temp file in one line?

I have a lot of (virtual) machines to initialize, so I wrote an init script and put it on a web server. Usually I paste the following four lines as one line to console, so that the VM can be initialized expected.
TEMPFILE = `mktemp`
curl http://host/path/to/init.sh > $TEMPFILE
sh $TEMPFILE
\rm $TEMPFILE

How to write it more elegant and compact? 

A:

You can directly pipe curl's output to the shell:
curl http://host/path/to/init.sh | sh

No tempfile is needed.

However, this is potentially insecure because a hacker might modify init.sh during transmission and will be able to execute arbitrary code on your system then. I would at least suggest to use https

