xsel -o equivalent for OS X

2020-07-24 04:51发布

问题:

Is there an equivalent solution to grab selected text in OS X as 'xsel -o' works for Linux?

Just need the current selection so I can use the text in shell script.

Cheers, Erik

回答1:

You can probably install xsel on MacOS. (UPDATE: According to Arkku's comment, that will only work if you have the X11 server running and synchronized to the OS X pasteboard.)

If not, a quick Google search turns up pbcopy / pbpaste, which apparently is pre-installed.

Link: https://github.com/raymontag/keepassc/issues/59