GNU Screen: Environment variables

此生再无相见时 提交于 2019-12-04 17:51:53
Chen Levy

The following command does not create a new screen session, but it will create a screen internal variable. Running it on the command line allow you to use the shell expansion:

$ screen -X setenv a "$PWD/debugging_code.php"

Then use the new variable:

C-a :readbuf $a

I have made a patch to screen 4.0.3 that supports the following syntax:

^A :readbuf !shell-command

This allows you to exec any arbitrary shell command and pipe the output into the screen buffer. Note that this is implemented by executing a subshell using popen and copying the standard output to the current file specified in the bufferfile setting (and then reading that file), so be careful you don't overwrite something you don't intend to. Also, this patch is probably terribly insecure so please use it at your own risk.

An example might be:

^A :readbuf !cat $HOME/projects/foobar/file.txt

Any shell command is executed literally as typed.

See gnu-screen-readbuf-exec on Github for the Git repository containing the patch.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!