Paste clipboard content into a variable in bash using xclip

最后都变了- 提交于 2019-12-10 10:26:49

问题


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?


回答1:


To assign the output of a command to a variable, you can use command substitution:

myvar=$( command )
echo "$myvar"


来源:https://stackoverflow.com/questions/23046580/paste-clipboard-content-into-a-variable-in-bash-using-xclip

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!