📜  附加剪贴板 - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:55.359000             🧑  作者: Mango

代码示例1
#!bin/bash
# this is another version of clipboard append tool
# here we use a temporary file to append highlighted text to the clipboard
# the temporary file is deleted at the end of the operation

tmpfile="file111000111"
xclip -selection clipboard -o  > $tmpfile   # first dump the current clipboard to the tmpfile
printf '\n' >> $tmpfile                     # then add new line
xclip -selection primary -o >> $tmpfile     # and finally add the highlighted text
cat $tmpfile | xclip -selection clip        # now read the file back into the clipboard
rm $tmpfile             # and remove the tempfile