A
A
Alexey Akulovich2012-11-08 12:03:22
FreeBSD
Alexey Akulovich, 2012-11-08 12:03:22

Getting tail from screen?

FreeBSD 8.
There is screen already running, doing something there (run as -dmS without -L logging).
Is it possible to rip out the last few lines of output from it with a script? :)
The option with manual screen -x…, copy&paste, С+ad is not considered. Restarting screen with -L is too late, there are a lot of them, and they work with might and main.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alukardd, 2012-11-08
@AterCattus

You can send any command to any window of any screen. Oh, how I wrapped it)
screen -S name -p 0 -X hardcopy
screen -S name -p 0 -X stuff 'ls -l^M'
stuff is screen's internal command to supply text to screen's input ... Will be sent to the null window screen with the name name command ls -l. ^M is needed instead of pressing Enter. ^M is not just printed, but inserted as an escape sequence, you can get it like this: Ctrl-v Ctrl-m and the character will appear.
Or you can write it like this: screen -S name -p 0 -X stuff 'ls -'`echo -ne '\015'` .

J
jcmvbkbc, 2012-11-08
@jcmvbkbc

Press ^a H there - and you will have a log of the current window in the current directory with the name screenlog.<window number>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question