Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Somebody needs to write a tutorial for MobileTerminal. I didn't realize that if you held down on the screen for a second or so/moved your thumb up that options came up.
 
I haven't worked on copying but I use these two scripts to paste. The first one is not as good as it just grabs the top line from the SBSettings fast notes, so you have to paste into fast notes first, then access it from the terminal. It can be useful though.

Code:
#! /bin/sh
head -1 /var/mobile/Library/SBSettings/note.txt

This next one is better. It requires awk and PasteBoardStacker (dont remember the repo right now, but can find it tomorrow if needed). I would have used the system's PasteBoard, but it's half gibberish and I haven't tried to decode it yet.

PasteBoardStacker keeps a list of the things you have copied so you can click on them to paste. It can remember 20-100 items but you can change it's plist to less. I have it set for 3, which is plenty for me. This script will paste the last thing copied by grabbing it from PasteBoardStacker so everything is transparent. You copy it from another app then run this script and it automatically pastes to in Terminal.

I call this one "clip" and it can be used it two ways, which you may already recognize. The first is just typing clip and piping it to other commands, the second is using a sub-shell. If you want to download a file, for example, copy the link and use "wget $(clip)" in terminal. $(clip) will run first so the result is "wget www.link.com"

Code:
#! /bin/sh
awk 'BEGIN{ RS="</string>"}{gsub(/.*<string>/,"");print;exit}' /var/mobile/Library/Preferences/com.hitoriblog.pasteboardstacker.plist

I may try to work on some sort of copy. It wouldn't be a highlight/copy obviously, but it shouldn't be too hard to pipe to a "copy" script that gets the text into PasteBoardStacker's list.
 
I really just need to paste in mobile terminal.

This next one is better. It requires awk and PasteBoardStacker (dont remember the repo right now, but can find it tomorrow if needed). I would have used the system's PasteBoard, but it's half gibberish and I haven't tried to decode it yet.

PasteBoardStacker keeps a list of the things you have copied so you can click on them to paste. It can remember 20-100 items but you can change it's plist to less. I have it set for 3, which is plenty for me. This script will paste the last thing copied by grabbing it from PasteBoardStacker so everything is transparent. You copy it from another app then run this script and it automatically pastes to in Terminal.

I call this one "clip" and it can be used it two ways, which you may already recognize. The first is just typing clip and piping it to other commands, the second is using a sub-shell. If you want to download a file, for example, copy the link and use "wget $(clip)" in terminal. $(clip) will run first so the result is "wget www.link.com"

Code:
#! /bin/sh
awk 'BEGIN{ RS="</string>"}{gsub(/.*<string>/,"");print;exit}' /var/mobile/Library/Preferences/com.hitoriblog.pasteboardstacker.plist

I may try to work on some sort of copy. It wouldn't be a highlight/copy obviously, but it shouldn't be too hard to pipe to a "copy" script that gets the text into PasteBoardStacker's list.

Exactly how do i use this?
 
Exactly how do i use this?
Copy and paste it into a text file. Name it whatever you want, like "paste", no extension is needed. Put it in /bin then type this in the terminal chmod 755 /bin/paste. Its ready to use, just type "paste" in terminal.

If you use windows, I would suggest doing this all on the phone and not the computer. If you put it in a file and transfer it to the phone, windows can mess up the line breaks.


This next one should work for "copy." To use, pipe output to it like: echo "hello world" | copy and "hello world" will then show up in the PasteBoardStacker clipboard.

I will work on improving this one because the text won't be in the Apple PasteBoard, you have to select the text from PasteBoardStacker by tapping the status bar and tapping the text. It's still a good way to get text from terminal to another app though. Special characters also to be escaped. echo "this is a test!" | ./copy won't work but echo "this is a test\!" | ./copy will.

Code:
#! /bin/sh
in=$(cat -)
text=$(echo '<string>'"$in"'</string>')
file=/var/mobile/Library/Preferences/com.hitoriblog.pasteboardstacker.plist
sed -i "7i\\
$text" $file
 
Does anyone know how to copy and paste in mobileterminal? I looked for pasteboardstacker but couldn't add the moyashi source in cydia.

Is there an alternative clipboard manager for the iPhone? I have a 3gs on 3.1.3 fw. Also any info on how to cut and paste in mobileterminal would be helpful.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.