1

I found from here that you can use ANSCI Escape sequence to copy from a remote ssh session like so,

printf "\033]52;c;$(printf "%s" "blabla" | base64)\a"

I have tried issuing command,

$ (file=README.md; printf "\033]52;c;$(base64 $file)\a")

But I am able to print only the first few characters (~57 characters). Is there a way to copy the whole content of a file with the Escape sequence?

phoxd
  • 131
  • 1
  • 5
  • Is there a reason you are not just [using `scp` to copy the files](https://askubuntu.com/a/646448)? – cocomac Nov 17 '21 at 20:10
  • It would be more convenient since I am usually in an interactive session. – phoxd Nov 17 '21 at 20:19
  • you are missing the %s specifier on the first `printf` –  Nov 17 '21 at 20:36
  • Also see [this answer](https://askubuntu.com/a/13586/1438484). It looks like it does what you want, and looks far easier @bac0n Mind posting that like an answer? It looks like it would be a good one! – cocomac Nov 17 '21 at 20:57

1 Answers1

2

If you want the output printed to the clipboard you may use xclip

xclip -sel -p -i < <( \
 printf %s%s%s '\033]52;c;' "$(printf %s blabla | base64)" '\a' \
)