简体   繁体   English

从系统Mac OSX剪贴板粘贴到终端

[英]Paste from system mac osx clipboard into terminal

I'm trying to use python-markdown to convert the system clipboard contents into HTML by running a shell script after pressing a hotkey and sending the processed markdown to pbcopy . 我正在尝试使用python-markdown通过在按下热键并将已处理的markdown发送给pbcopy之后运行shell脚本来将系统剪贴板内容转换为HTML。 The following is the shell script to make this happen. 以下是执行此操作的Shell脚本。

#!/bin/sh
echo `pbpaste` | python -m markdown | pbcopy

The issue already known is that pbpaste will not contain the systems clipboard contents. 已知的问题是pbpaste将不包含系统剪贴板内容。 Is there a similar utility to pbpaste that stores the clipboard contents? 是否有类似pbpaste实用程序来存储剪贴板内容?

pbpaste should work for this. pbpaste应该为此工作。 You can even specify the general clipboard to ensure you're getting the main system clipboard. 您甚至可以指定常规剪贴板,以确保获得主系统剪贴板。

#!/bin/sh

pbpaste -pboard general | python -m markdown | pbcopy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM