#!/bin/bash
CLIP=$(termux-clipboard-get)
ssh user@ip 'cat>~/Scripts/clip.log<<<$CLIP'
This is a very basic bash script to forward my system clipboard from my phone (through termux) into a file on my desktop through SSH.
The issue is the third line, I can't get it to write what's stored in the variable and it ends up writing nothing.
I've tested:
echo $CLIP, and the clipboard request works.- replacing
$CLIPwith a string, andclip.logupdates properly.
It would work better if you used a pipe rather than a variable. Then you don't need to worry as much about escaping or quotes.
If you want it to append to the log file, you could use
>>rather than>.