Linux – stdout to gnu screen copy buffer

bashconsolegnu-screenlinuxterminal-server

Is there a command in GNU Screen to direct standard output to the copy buffer

I've been doing alot of work with files, it's great to copy and past the filenames I want into commands

e.g.

ls | grep proc

$ ls | grep cal
calendar.inc-gen.php

// enter copy mode
$^a y 
// backward search for gen_chg
? cal
// start region
SPC
//goto to end of file by forward search php
php
// done 
ENT
// type command line
$ git rm ^p
// creates
$ git rm calendar.inc-gen.php

I'm aware there are easier ways to do this with a bash script, but often I find myself needed a specialized piece of information from the terminal screen and it would be great to just type

ls | grep cal > To_GNU_SREEN_COPY_:) or something

dennis's solution below works

you may need to set the bufferfile in your .screenrc
bufferfile /tmp/screen-exchange

Best Answer

Here's one way:

echo -n cal* > /tmp/screen-exchange
screen -X readbuf    # or press Ctrl-a <
git rm ^a]           # type "git rm" then press Ctrl-a ]