1 2 3 4 5 6 7
#!/bin/bash if [ -p /dev/stdin ]; then printf "%s" "$(cat)" | xclip -selection clipboard else echo "Pipe data to this program to copy it into your clipboard" fi