People often use a pasting site to share the output of unix commands
for diagnostic purposes.  Which is good.  But if they're working from
a non-X terminal, they usually can't copy/paste the text they want to
copy.  They end up running something like pastebinit or curl to send
the output to a web site which spits back a URL containing the data.

The problem for people trying to interpret this output is that we
don't see the original command -- just the output.  Without knowing
what command was used to produce the output, it may not be useful.

It's a fundamental law of unix that a piped command only sends the
command's output through the pipeline, not the command itself.

To break a law, you need some magic.


Magic aliases:
https://www.chiark.greenend.org.uk/~sgtatham/aliases.html


Sprunge magic alias:

sprunge_helper () { 
  local cmd
  read -r _ _ cmd < <(history 1)
  { printf 'bash$ %s\n' "$cmd"; eval "$cmd"; } |
    http_proxy= curl -F 'sprunge=<-' http://sprunge.us/
}
alias sprunge='sprunge_helper # '


Ix variant:

ix_helper () {
  local cmd
  read -r _ _ cmd < <(history 1)
  { printf 'bash$ %s\n' "$cmd"; eval "$cmd"; } |
    http_proxy= curl -F 'f:1=<-' http://ix.io/
}
alias ix='ix_helper # '


Example:

wooledg:~$ sprunge ls -lart *.png | tail -1
http://sprunge.us/TaYB
wooledg:~$ curl -s http://sprunge.us/TaYB
bash$ ls -lart *.png | tail -1
-rw-r--r-- 1 wooledg    1000    9641 May  4 08:16 viera.png


Do not ask for help with magic aliases.  Do not expect them to conform to
your preconceived notions of logic.  They are subtle and quick to anger,
and you are crunchy and taste good with ketchup.