Answers for "append clipboard"

0

append clipboard

#!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
Posted by: Guest on February-14-2021

Browse Popular Code Answers by Language