Last active
September 9, 2021 16:00
-
-
Save yoursdearboy/6b5d947e15a09db8f2d91c60922ed572 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
if [ "$#" -lt 1 ]; then | |
echo "Usage: clipserver.sh 127.0.0.1 [1234]" | |
exit | |
fi | |
ADDR=$1 | |
if [ "$#" -eq 2 ]; then PORT=$2; else PORT=$RANDOM; fi | |
echo "Serving clipboard on $ADDR:$PORT" | |
echo "Press Ctrl-C to terminate" | |
while true; do pbpaste | nc -l $ADDR $PORT; test $? -gt 128 && break; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment