pbpaste, allow you to copy and paste text from the clipboard within a shell script.
pbcopy takes standard in and places it in the specified pasteboard (the clipboard). For example, to capture the output of the
ls -1 command, pipe the output to pbcopy:
ls -1 | pbcopy
Now, the results can be pasted into any program that supports the clipboard.
pbpastewrites the contents of the pasteboard (the clipboard) to standard out. For example, to paste the contents of the clipboard into a text file called "output.txt", use:
pbpaste > output.txt