The script's key line is this:
url=$(curl -s -F 'f:1=<-' http://ix.io)
My gaze was immediately drawn to this bit:
-F 'f:1=<-'. Part of this initially cryptic incantation is actually down to the instructions from the ix.io website itself, in the TL;DR section.
curl documentation for the
-F option, I discover that this venerable command line HTTP client can send multipart/form-data payloads, with files or file contents. So, breaking this incantation down, we have:
|send a POST with multipart/form-data content|
|the name of the form field that the website is expecting|
|send as file contents (rather than an actual file)|
|read the contents from STDIN|
And in the context of where this is being executed, STDIN is the
ix script's STDIN, in other words, whatever is piped into
ix when it's invoked.
In response to the form being POSTed, the ix.io website returns the newly minted unique pastebin URL that was created, and this is saved into the
url variable in the script, to be shared in various ways.