Skip to content

Instantly share code, notes, and snippets.

@Efreak
Created August 5, 2019 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Efreak/909ea12f341342a671a6935be676929e to your computer and use it in GitHub Desktop.
Save Efreak/909ea12f341342a671a6935be676929e to your computer and use it in GitHub Desktop.
Termux clip command. Clipboard is set from piped text or from parameters, otherwise it displays the contents. WTFPL.
#!/usr/bin/env bash
if [ -t 0 -a $# -gt 0 ]; then
termux-clipboard-set "$@"
echo "$@"
elif [ -t 0 ]; then
termux-clipboard-get
else
p=`cat`
echo "$p" | termux-clipboard-set
echo "$p"
fi
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment