|
#1
| |||
| |||
| Just found you can communicate (copy/paste) with the clipboard (or pasteboard) from the command line; most likely to be found useful in shell scripts... The commands are pbcopy and pbpaste: echo -n "copy this" | pbcopy copies the string 'copy this' to the clipboard (the -n is to keep echo from adding a newline). Simply running pbpaste will output what's in the clipboard. |
|
#2
| ||||
| ||||
| Quote:
in conjunction with AEShell OSAX from within Applescript as well...
__________________ iMac DV+ (Sage), 450MHz G3 512MB RAM, 20GB HD (ATA), DVD (ATA) ProductName: Mac OS X ProductVersion: 10.1.4 BuildVersion: 5Q125 |
|
#3
| ||||
| ||||
| As useful as this command can be, I seem to be stuck with it. Whenever I start a new shell, it runs "pbpaste | sh" and if there happens to be some text in the clipboard, this will get pasted and executed, which generally generates a "command not found". I have looked in (some of these files didn't exist for me): /etc/csh.cshrc /etc/csh.login ~/.tcshrc & ~/.tcshistory ~/.cshrc ~/.history ~/.login ~/.cshdirs This particular command isn't in any of these files. Is there some way I can reset my Terminal back to "vanilla" or the likes? My apologies if this is the wrong place to post such a question! Please help, this is very annoying. deev |
|
#4
| ||||
| ||||
| Deev: Have you checked the Terminal Preferences dialog? it is possible to set a command to be executed each time a term window opens by putting it here. You might also delete the com.apple.Terminal.plist file from ~/Library/Preferences. BLB: Thanks for the tip! That could make some really nifty shell script tricks that would be the envy of any Linux geek. ![]()
__________________ - iMac G5 1.8GHZ 17" | SuperDrive | 160GB | 512MB | Airport Extreme | Bluetooth Keyboard & Mouse | Wacom Intuos II - Pentax *ist DL - JVC MiniDV Camcorder - Airport Express - iPod Nano 1gb white |
|
#5
| ||||
| ||||
| Quote:
I shoulda known it would be something simple (relatively!). Thanks again, deev |
|
#6
| ||||
| ||||
| blb, that is way .What happens, though, if someone logs in over SSH, who is not the same user as the one at the con, and tries pbpaste? Will it display the console's clipboard ?!
__________________ michaelsanford.com Blog Twitter Tumblr LinkedIn iMac Aluminum 24" | MacOS X 10.5-current | 3.06 GHz Intel Core Duo | 4 GB RAM | 1 TB HDD iBook G4 1.42 GHz | MacOS X 10.5-current | 1 GB RAM, 100 GB HDD AMD Athlon64 3500+ | Slackware 12 (2.6.21.5-smp) | 2 GB RAM, 2120 GB RAID 1, 2500 GB RAID 0 |
|
#7
| ||||
| ||||
| Picking up on what michaelsanford asked... I presume command line pbcopy & pbpaste are users specific? So if I'm loggend in as me vs another user, will that will only affect that particular user? If I login vi ssh and do this at the same time someone is on the Machine GUI could I screw with their paste board by doing this at the same time they are? Are tehre security issues here?
__________________ TommyWillB Intel iMac 250GB external drive TommyWillB.com hosted on Mac OS X 10.4.x / Apache 1.3.x / PHP 4.x |
|
#8
| |||
| |||
| Unfortunately, there is a single, globally readable and writable clipboard. Which is to say, yes, there is a huge security hole. Unprivileged users can use tools like this to view whatever is on another user's (including root's) clipboard. Worse, another using writing anything to "their" clipboard will also change what all other users get. Note that the problem isn't with pbcopy/pbpaste in particular, but rather the overall design of the clipboard service. Even if you remove these tools from your system, a user could create or install similar tools without needing any elevated privileges. I've been complaining to Apple about this literally for years. This is one of a few issues which make macosx completely unsuitable as a production server platform in my mind.
__________________ The correct plural of forum is fora. _Please_ fix the painfully illiterate references to 'forums'. |
![]() |
| Thread Tools | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Communicating between perl and FORTRAN. | simX | Mac OS X System & Mac Software | 4 | July 29th, 2002 06:48 AM |
| Not Going For Post Counts Only Communicating | Appletree | Bob's Place | 1 | June 1st, 2002 12:14 PM |
| Screen Shot to Clipboard | Gedankenspiel | Mac OS X System & Mac Software | 3 | February 21st, 2002 09:21 PM |
| global clipboard | onan | Mac OS X System & Mac Software | 0 | May 3rd, 2001 06:37 PM |