Robert
Robert

Reputation: 3870

How to get value from Clipboard in bash

like in subject. I'm curious how to get value in bash script from Clipboard.

I would like to write sh script which after execution will take value from Clipboard (Ctrl+c), but I haven't found how to get this value in the script.

Any idea folks, thanks :)

Upvotes: 3

Views: 7095

Answers (1)

Dan
Dan

Reputation: 4502

On Mac OS, pbcopy/pbpaste:

echo "Set the clipboard" | pbcopy

clipboard="$(pbpaste)"

On Linux with X11, xclip.

echo "Set the clipboard" | xclip

clipboard="$(xclip -o)"

Upvotes: 9

Related Questions