-
-
Save zongou/5a6a6e58c2cc621209ce259e224cdb78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# send text to android using built-in command on termux and anotherterm | |
[ -n "$TERMSH" ] && isAnotherterm="true" || isAnotherterm="false" | |
[ -n "$TERMUX_VERSION" ] && isTermux="true" || isTermux="false" | |
recipient="" | |
recipient="be.shiro.android.toclipboard/.ToClipboard" | |
if [ -n "$1" ]; then | |
if "$isAnotherterm"; then | |
"$TERMSH" send --text "$1" | |
elif "$isTermux"; then | |
am start \ | |
-a android.intent.action.SEND \ | |
-t text/plain \ | |
-e android.intent.extra.TEXT "$1" | |
fi | |
else | |
if "$isAnotherterm"; then | |
"$TERMSH" send --text-stdin | |
elif "$isTermux"; then | |
stdin=$(cat; printf x) | |
stdin=${stdin%x} | |
am start \ | |
-a android.intent.action.SEND \ | |
-t text/plain \ | |
-e android.intent.extra.TEXT "$stdin" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment