Paste clipboard content into a variable in bash using xclip
Domanda
I know this command will paste the clipboard contents into a file:
xclip -out -selection clipboard >> file.txt
If I want to paste clipboard content into a variable like a string what do I do?
Soluzione
To assign the output of a command to a variable, you can use command substitution:
myvar=$( command )
echo "$myvar"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow