mirror of
https://github.com/Ascyii/scripts.git
synced 2026-01-01 04:44:24 -05:00
23 lines
499 B
Bash
Executable File
23 lines
499 B
Bash
Executable File
#!/bin/sh
|
|
|
|
REMOTE_FILE="~/clip"
|
|
SEPARATOR='---xx---'
|
|
|
|
case "$1" in
|
|
append)
|
|
clipboard_content=$(wl-paste)
|
|
formatted_content="$SEPARATOR\n$clipboard_content\n"
|
|
echo -e "$formatted_content" | ssh bi "cat >> $REMOTE_FILE"
|
|
echo "Clipboard contents appended to remote file."
|
|
;;
|
|
retrieve)
|
|
lines=$(ssh bi "tac $REMOTE_FILE | awk '/$SEPARATOR/ {exit} {print}' | tac")
|
|
echo -e "$lines" | wl-copy
|
|
echo "Last entry copied to clipboard."
|
|
wtype $lines
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {append|retrieve}"
|
|
;;
|
|
esac
|