I want to read the contents of the file into the paste buffer and stdout it to the screen. I did this:

screen -X readbuf /home/nitro/file|screen -X writebuf|cat /tmp/screen-exchange

but the cat command showed me the screen-exchange file with the previous result of the readbuf command. If I do these commands separately, everything will be correct and I'll get the modified screen-exchange file.

How can I perform all three commands readbuf, writebuf and cat at once?


Those commands:

screen -X readbuf /home/nitro/file
screen -X writebuf
cat /tmp/screen-exchange

do not act as parts of a pipe, but your composite command attempts to treat them that way. That is, each step does not read the previous step's standard output, so there is less causal relationship among them than if you had typed

screen -X readbuf /home/nitro/file; screen -X writebuf; cat /tmp/screen-exchange


screen -X readbuf /home/nitro/file && screen -X writebuf && cat /tmp/screen-exchange

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.