Skip to content

Instantly share code, notes, and snippets.

@movsb
Created May 22, 2020 12:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save movsb/30beb738148f971865c1d28947fed9e5 to your computer and use it in GitHub Desktop.
Save movsb/30beb738148f971865c1d28947fed9e5 to your computer and use it in GitHub Desktop.
A MacOS pbcopy implementation for linux servers.
#!/bin/bash
set -euo pipefail
t=$(cat <&0 | base64 --wrap=0)
if [ ! -z ${STY+x} ]; then
echo -ne "\eP\e]52;c;$t\a\e\\"
elif [ ! -z ${TMUX+x} ]; then
echo -ne "\ePtmux;\e\e]52;c;$t\a\e\\"
else
echo -ne "\e]52;c;$t\a"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment