It occurred to me that it would be very convenient if pbcopy and pbpaste could be combined into a single command that could infer the desired behavior based on usage.
I.e., if the command is called at the beginning of a pipe, it should paste the current clipboard into the pipe:
$ clipboard | sort -fh $ clipboard > file1.txt And if the command is called at the end of a pipe, the command with save the input to the clipboard:
$ echo $PATH | sed "s/:/\\n/g" | clipboard So in general, is it possible to implement something like this?