Simply add this to your .bashrc or .zshrc or whatever you prefer:
alias strtoclipboard="osascript -e 'set the clipboard to \"STRING TO CLIPBOARD\"'"
Then open a new shell and execute your new alias strtoclipboard. CMD+V should show STRING TO CLIPBOARD. Adjust it to your needs.
It's pretty neat lets say for passwords which can't be saved.