image
image

Go Back   macosx.com > Mac Help Forums > Unix & X11

Reply
 
Thread Tools
  #1  
Old March 21st, 2008, 09:32 PM
Registered User
 
Join Date: Jun 2003
Location: oregon
Posts: 145
Thanks: 0
Thanked 0 Times in 0 Posts
blackoutspy is on a distinguished road
Piping text to Clipboard?

I find my self spending quite a bit of time in the terminal, and the work I do has me constantly taking some bits of information from the terminal and pasting them into other applications. I'm looking for a nice way to get text from the terminal to the clipboard. Something like:

"pwd > Clipboard"

I know that's never going to work but what I'm asking is if there's a semi nice way to do this, maybe piping the text to an apple script that will then place that text into the clipboard?

Does this even make sense to anyone?
Reply With Quote
  #2  
Old March 22nd, 2008, 03:27 PM
Mikuro's Avatar
Crotchety UI Nitpicker
 
Join Date: Mar 2005
Posts: 2,462
Thanks: 3
Thanked 10 Times in 9 Posts
Mikuro is on a distinguished road
Hmm. I tried rigging up an AppleScript using the osascript command, but as far as I can tell osascript will never accept script arguments from stdin. Bummer. You can do it with angle-quotes, but only if the output has no spaces or other non-shell-friendly characters.

Looks like macosxhints has the answer, though. http://www.macosxhints.com/article.p...03050204544799
It's as simple as:
Code:
pwd | pbcopy
Nice! This is one of those questions I wouldn't have thought to ask myself, but I'm glad to have the answer now.
__________________
Mac mini — 1.25GHz G4, 1GB RAM — OS 10.5.2

I'm now a four-browser man. How on earth did this happen?!

Useful programs: PithHelmet, Butler, ffmpegX, VLC, Perian, Tofu, Wcalc
Reply With Quote
  #3  
Old March 22nd, 2008, 03:31 PM
Registered User
 
Join Date: Mar 2005
Posts: 197
Thanks: 0
Thanked 1 Time in 1 Post
artov is on a distinguished road
Yes, it does. There seems to be a service called pboard. Also, there are two commands,
pbcopy and pbpaste that use the service.

$ pwd | pbpaste

does what you asked.

(All this I got by typing "man -k paste", which gave pboard, and then "man -k pboard")
Reply With Quote
  #4  
Old March 22nd, 2008, 03:35 PM
Registered User
 
Join Date: Mar 2005
Posts: 197
Thanks: 0
Thanked 1 Time in 1 Post
artov is on a distinguished road
Ooops! Mikuro already answered when I was typing my answer. Also, I should have used
pbcopy instead of pbpaste.
Reply With Quote
  #5  
Old March 22nd, 2008, 05:05 PM
Registered User
 
Join Date: Jun 2003
Location: oregon
Posts: 145
Thanks: 0
Thanked 0 Times in 0 Posts
blackoutspy is on a distinguished road
OOhhhh fantastic. I was really hoping something like that existed, GO APPLE. I spend alot of time looking for something like this on os x hints but I guess I was searching for the wrong things. Thanks guys
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 05:51 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.