Copying Console Text to the Clipboard
I created a new computer work flow associated with a hobby. I wrote a shell script that would be launched only manually. I designed the script to display important information. That was fine but being a lazy admin I wanted a specific string in that output to be copied to the desktop clipboard.
Searching the web revealed two common tools, xclip
and xsel
.
My initial efforts did not copy the string to the clipboard. Eventually the following script snippet succeeded:
echo -n “$STRING” | xclip -selection clipboard
The -n
option ensures no annoying line feeds are part of the clipboard content.
Posted: Usability Tagged: General
Category:Next: Windows 10 P2V
Previous: Inode Extent Could Be Narrower