#!/bin/bash # Takes some text from stdin and use the pastebin service ix.io to # generate a link. The link is then printed to stdout and automatically # copied to the clipboard. # N.B. `head -c-1` removes the trailing newline from the output of the # `curl` command, because newlines in the clipboard are usually # annoying. cat - | curl -sF 'f:1=<-' ix.io | head -c-1 | xclip -f -i -selection clipboard && echo