Copy a string to clipboard from Mac OS command line

前端 未结 2 1739
灰色年华
灰色年华 2021-02-13 14:43

is there a way to copy a string to clipboard from command line?

To be more specific, I want to make a script which copies my email address to clipboard, so that when I n

相关标签:
2条回答
  • 2021-02-13 15:15

    You need to pipe the output of your script to pbcopy

    For example:

    ./somescript.sh | pbcopy
    
    0 讨论(0)
  • 2021-02-13 15:21

    echo 'your-email@example.com' | pbcopy (as @Jonathan Leffler stated above)

    Or see the answer for the related question on piping to clipboard on different operating systems: Pipe to/from the clipboard in Bash script

    0 讨论(0)
提交回复
热议问题