I need help wit a script

Dradts

Official Mac User
Hi!

I'd like to write me a script which deletes 3 files from the ~/library/preferences folder and the copies a string into the clipboard. Is this possible? I know how to delete the files, but I don't know how to copy a text into the clipboard via script.
Can somebody help me? :)
 
The command you're looking for is pbcopy:

Code:
echo -n "this will be on the clipboard" | pbcopy

will put the string "this will be on the clipboard" on the clipboard without any return at the end (the -n for echo).
 
Whoah! That is pretty sweet! How do you discover these thing - are they documented?
 
That one (and the corresponding pbpaste) doesn't have a man page, so I haven't seen any real documentation...was just looking at what was in /usr/bin and saw pbcopy and pbpaste, and curiosity took it from there.
 
Back
Top