bash - Possible to create burn-after-execute temp file in one line? -
i have lot of (virtual) machines initialize, wrote init script , put on web server. paste following 4 lines 1 line console, vm can initialized expected.
tempfile = `mktemp` curl http://host/path/to/init.sh > $tempfile sh $tempfile \rm $tempfile
how write more elegant , compact?
you can directly pipe curl
's output shell:
curl http://host/path/to/init.sh | sh
no tempfile needed.
however, potentially insecure because hacker might modify init.sh
during transmission , able execute arbitrary code on system then. @ least suggest use https
Comments
Post a Comment