Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Help with pbcopy

Help with pbcopy
Thread Tools
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Jun 7, 2004, 03:07 PM
 
Hi, I'm trying to get a script that will place the date in predefined format into the clipboard, but can't seem to get it to work:

insert=$(date "+%b|%e|%g"); pbpaste -pboard $insert

any ideas?
     
JNI
Forum Regular
Join Date: Oct 2002
Location: Left Coast
Status: Offline
Reply With Quote
Jun 7, 2004, 07:57 PM
 
First off, to put something into the pasteboard, you use pbcopy. pbpaste is for getting stuff out.

pbcopy takes its input from stdin, so you you can do something like this:

date "+%b|%e|%g" | pbcopy

or if the date string was already in a variable you could do

echo -n $insert | pbcopy

or any of the other myriad ways to pipe something into pbcopy.

The -pboard option is used for getting/setting data of one of the named pasteboards. You then need to supply the name of a pasteboard. Without the option, the 'general' pasteboard is used.

Of course all of this is described nicely in the man pages...
(Last edited by JNI; Jun 7, 2004 at 08:03 PM. )
     
   
Thread Tools
Forum Links
Forum 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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 04:34 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2