A quick Google search turns up the application xclip, and a lot of information about how Linux uses three clipboards, and they're all for different things, and.... yawn.
Anyways, with the right switches, xclip can read from STDIN and put the information into your x clipboard ready for pasting via the mouse or the keyboard shortcut. Very handy!
First I installed xclip
Code: Select all
sudo apt-get install xclipAnd then, the test
Code: Select all
echo Hello | xclip -i -selection clipboardNow a further test
Code: Select all
cat path/to/some/file.txt | xclip -i -selection clipboardNow make it into a script
Code: Select all
#!/bin/bash
# cat to clipboard
#
cat $1 | xclip -i -selection clipboard
exitCode: Select all
chmod +x clippitCode: Select all
sudo cp ./clippit /usr/binCode: Select all
clippit /path/to/fileAnd there you have it. Happy pasting!

