从Mac OS命令行将字符串复制到剪贴板 [英] Copy a string to clipboard from Mac OS command line
本文介绍了从Mac OS命令行将字符串复制到剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以从命令行将字符串复制到剪贴板?
is there a way to copy a string to clipboard from command line?
更具体地说,我想创建一个脚本,将我的电子邮件地址复制到剪贴板,以便当我需要多次插入该地址以登录/注册时,我只运行一次脚本,然后执行CMD + V每当我需要的时候.
To be more specific, I want to make a script which copies my email address to clipboard, so that when I need to insert it several times for logging in / register, I just run the script once and then CMD+V it whenever I need.
我听说过pbcopy
,但是我认为这不是我的情况.有什么建议吗?
非常感谢!
I heard of pbcopy
, but I think this is not my case. Any suggestion?
Many thanks!
推荐答案
您需要将脚本的输出通过管道传输到pbcopy
You need to pipe the output of your script to pbcopy
例如:
./somescript.sh | pbcopy
这篇关于从Mac OS命令行将字符串复制到剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文