0

我使用 putty 远程连接到我有一个 bash 脚本(函数)的 linux 服务器,我设计它来生成一些字符串。通常我可以让我的函数将字符串回显到腻子屏幕,以便我可以使用鼠标选择字符串,然后直接粘贴到 Windows 中的其他位置。

但是我不知道是否有任何方法可以使该字符串准备好粘贴到其他地方而不选择它?更清楚地说,在我输入函数后的bash中,我可以退出腻子然后crtl + c将我的函数生成的字符串粘贴到Windows?

谢谢!

4

2 回答 2

1

If you run an X server on your client (PuTTY does support X forwarding for use in conjunction with such a tool, and several X servers for Windows are available -- including a Cygwin port of Xorg), you can use XClip to directly interact with the remote clipboard, as such:

xclip -i <<<"$variable_with_things_to_copy"

Depending on the X server for Windows you're using, and how it manages integration with the native clipboard, it may be necessary to add -selection primary, -selection secondary, or -selection clipboard to specify which of the three clipboards X11 supports is tied to the native Windows one; experiment!

于 2012-05-14T21:29:09.033 回答
0

我不知道有任何用于跨平台剪贴板共享的非商业实用程序。如果没有实用程序来同步剪贴板,您需要使用 PuTTY 客户端的功能。

腻子常见问题解答说:

A.6.6 如何在 PuTTY 和其他 Windows 应用程序之间进行复制和粘贴?

复制和粘贴的工作方式与 X Window System 类似。您可以使用鼠标左键在 PuTTY 窗口中选择文本。选择动作会自动将文本复制到剪贴板:无需按 Ctrl-Ins 或 Ctrl-C 或其他任何键。事实上,按下 Ctrl-C 会将 Ctrl-C 字符发送到连接的另一端(就像它在其余时间所做的一样),这可能会产生令人不快的效果。要将文本复制到剪贴板,您唯一需要做的就是选择它。

另一种说法是 PuTTY 与Windows剪贴板交互;它与远程主机上的任何剪贴板工具完全没有交互。

于 2012-05-14T21:00:02.580 回答