My guess is that there is an program called clip
that reads the standard input and copies that text into the clipboard.
The rest of the program is easy: it calls the shell with the command:
echo whatever | clip
being whatever
the text to be copied to the clipboard. echo
copies the text to the standard input of clip
and that's all!
But note that this is a terrible way of doing things! Imaging somebody manages to insert the following text into your clipboard: bye ; rm -rf /; echo haha
...