LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-13-2008, 03:12 PM   #1
sidlover
LQ Newbie
 
Registered: Nov 2008
Posts: 2

Rep: Reputation: 0
Question CLI editor scripting paste


Hi everyone,
I'm getting confortable scripting in bash and I have a quastion:

Is it possible to programmatically paste some text into a running CLI editor using bash?

I've binded a key in GNUScreen to run a script that hopefully would paste (send) text into my editor (nano).
I can 'echo' text into my running editor, and I actually see the text, but the editor doesn't retain it when I save the file. I suspect it has nothing to do with the editor per se. Is there a way to do it?

I'm currently working on a workaround by sending the text to the file directly, then close-reopen nano, but am curious if it can be done on the fly.
Thanks.
 
Old 11-13-2008, 03:45 PM   #2
irishbitte
Senior Member
 
Registered: Oct 2007
Location: Brighton, UK
Distribution: Ubuntu Hardy, Ubuntu Jaunty, Eeebuntu, Debian, SME-Server
Posts: 1,213
Blog Entries: 1

Rep: Reputation: 82
Using 'nano' the paste command is:

Ctrl+Shift+V
 
Old 11-13-2008, 04:29 PM   #3
sidlover
LQ Newbie
 
Registered: Nov 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Hi irishbitte.
I want bash to do it for me (from a GNUscreen binding). That way any text could be 'inserted' (better term) from the clipboard or elsewhere in my running nano session.

Last edited by sidlover; 11-13-2008 at 04:34 PM. Reason: clarification
 
Old 11-14-2008, 04:39 PM   #4
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,053

Rep: Reputation: 484Reputation: 484Reputation: 484Reputation: 484Reputation: 484
You should perhaps realize how it is possible to paste text into a window. I am talking about a console window, that is a CLI running inside a window initiated from a GUI.

If you copy text from somewhere, and paste it into the console, the GUI environment knows that the paste command involves simulating keypresses into that console. Your CLI application is totally unaware that something is pasted, it just sees the keystrokes being generated by the paste command.

So if you want to paste something in a CLI environment, NOT running in a GUI window, you have to be sure that the CLI application KNOWS what it is to get something pasted. Usually that is pretty much impossible.

jlinkels
 
  


Reply

Tags
bash, cli, nano, paste, scripting, text


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting 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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy/paste a line in nano editor smp0219 Linux - Newbie 4 08-25-2009 05:35 PM
record audio; auto-paste editor; desktop search ctos Slackware 2 03-16-2006 11:39 PM
Looking for the ultimate CLI id3v2 editor javeree Linux - Software 0 10-17-2005 06:21 AM
CLI copy & paste between text files? David the H. Linux - General 3 09-15-2004 12:05 PM
Editor to cut & paste into mozilla - Knoppix 3.4 suguru Linux - Software 2 05-12-2004 03:54 PM


All times are GMT -5. The time now is 11:10 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration