Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Empty clipboard to specified file every $WAIT seconds
- WAIT=1 # Time to wait (in seconds)
- # If no file is given, print usage and exit
- if [ "x$1" = "x" ];
- then
- echo "Usage: $(basename $0) <file>"
- exit 1
- fi
- # Create file if it doesn't exist
- if [ ! -a "$1" ];
- then
- touch "$1"
- fi
- while true; do
- if [ "$(echo $(xclip -o))" != "$(tail -1 "$1")" ];
- then
- echo $(xclip -o) >> "$1"
- fi
- sleep ${WAIT}s
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement