Is there any easy way to implement the copy to clipboard option from the output of a shell script ?
PRIMARY: The PRIMARY selection is conventionally used to implement copying and pasting via the middle mouse button. xclip command use this by default. So you need to hit middle button to paste data. SECONDARY: This is less frequently used by X application.
Ctrl+Shift+C and Ctrl+Shift+V If you highlight text in the terminal window with your mouse and hit Ctrl+Shift+C you'll copy that text into a clipboard buffer. You can use Ctrl+Shift+V to paste the copied text into the same terminal window, or into another terminal window.
That may depend on the environment you're using. With Gnome at least (I haven't tried the others but it may work), you can pipe your output as follows:
echo 123 | xclip echo 123 | xclip -sel clip
The first goes to the mouse clipboard, the second to the "normal" clipboard.
You can use pbcopy
which is native for Mac OS.
Try this command:
echo "variable" | pbcopy
it will copy the string "variable" into your clipboard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With