Command-Line
如何使用 xclip 定位多個選擇
將文本複製到剪貼板時,xclip提供了幾個選擇目標:
-selection specify which X selection to use, options are: "primary" to use XA_PRIMARY (default), "secondary" for XA_SECONDARY "clipboard" for XA_CLIPBOARD
有沒有辦法針對多個選擇?
我嘗試了以下選項
echo "Hello world" | xclip -i -selection primary -selection clipboard
echo "Hello world" | xclip -i selection primary | xclip -i selection clipboard
echo "Hello world" | xclip -i selection primary,clipboard
但他們都沒有工作。
我嘗試了以下選項
echo "Hello world" | xclip -i selection primary | xclip -i selection clipboard
你真的很接近……
如果你使用
-f
第一個xclip
命令,它會將文本列印回標準輸出,你可以將它傳遞給第二個xclip
命令:echo "Hello World" | xclip -i -sel p -f | xclip -i -sel c
來自
man xclip
:-f, -filter when xclip is invoked in the in mode with output level set to silent (the defaults), the filter option will cause xclip to print the text piped to standard in back to standard out unmodified