append clipboard code example

Example: 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

Tags:

Php Example