iPhone and Linux

Friday, November 6, 2009

Send copied text from iPhone to Linux desktop Redux

That last post using mailx to send the iPhone's clipboard contents tested great then started failing. I tried to work out the bugs but it didn't cooperate. Mailx crashes often when executed from a SpringBoard icon and the sed line tests well then stops working for some unknown reason.

I finally gave up and found a better, faster, and more reliable alternative, and that's to use an auto-login to scp the clipboard file to the PC, where processing can take place.

Setting up scp to auto-login is pretty simple. It involves creating a keypair and moving the private key to the iPhone, then logging in to the computer with that key. Here is a more detailed guide.

Once the auto-login is set up, use this script on the iPhone:

#! /bin/sh
cd /var/mobile
scp -i ~/.ssh/KEY ~/Library/Preferences/com.hitoriblog.pasteboardstacker.plist USERNAME@IPADDRESS:/PATH/TO/PUT/THE/FILE


Now you can do the text processing on the computer. I will tweak that soon-tomorrow if I have the time- and post the results.

Blog Archive