I've found myself needing to do this a couple of times lately and wondered if there was a way to do this in the OS already. Failing that, I've got a pretty good idea of how to write a script to do it, I just need to know how to access the clipboard in os x.
views:
147answers:
2
+7
Q:
Is it possible to send the contents of a text file to the clipboard from the command line in OS X?
+4
A:
Nevermind, figured it out.
pbcopy < filename
#copies contents of a text, rtf, or eps file to the clipboard
pbpaste
#pastes content of clipboard to stdout
Paul Wicks
2008-09-18 19:27:27
That's awesome. Where did you find this info, and are there other cool conduits between CLI world and GUI world?
slim
2008-09-18 19:32:23
+2
A:
Yep, that's the way to go. Of course, you can also pipe output into it, ie, echo "test" | pbcopy
.
William Keller
2008-09-18 19:31:29