Is there a way to read the current terminal content (visible window, or full buffer, whatever it's easier) programmatically?
I need this because I'm trying to develop a program which, after executing an arbitrary command, works with its output. I stress after - I know pipes are used for this, but the purpose of the program is avoiding that.
A possible solution would be a combination of a programmatic Select all
followed by an xsel
invocation, although I don't know any way to perform the first operation [in Gnome Terminal].
xdotool
to send keystrokes to your terminal. If you can't copy the screen with keystrokes in gnome terminal, you can do it in ascreen
session and do a:hardcopy
there.