cclip (315B)
1 #!/bin/sh 2 f="cclip.txt" 3 4 toclip() { 5 upload "$f" >/dev/null 6 } 7 8 fromclip() { 9 upload -g "$f" 10 if [ "$1" = nonewline ]; then 11 printf '%s' "$(cat "$f")" 12 else 13 printf '%s\n' "$(cat "$f")" 14 fi 15 rm -f "$f" 16 } 17 18 if [ "$1" = "-o" ]; then 19 if [ "$2" = "-n" ]; then 20 fromclip nonewline 21 else 22 fromclip 23 fi 24 else 25 toclip 26 fi