CLI editor scripting paste
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.
Using 'nano' the paste command is:
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.
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.
|All times are GMT -5. The time now is 01:33 AM.|