Last active
August 2, 2021 06:19
-
-
Save gerardo-junior/0876935c91a83c4b87661c649217397c to your computer and use it in GitHub Desktop.
fixed termux-send-sms script after removing the sms feature
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
#!/data/data/com.termux/files/usr/bin/sh | |
set -e -u | |
# Frist install https://f-droid.org/en/packages/com.android.shellms/ and give sms permission manually | |
SCRIPTNAME=termux-sms-send | |
show_usage () { | |
echo "Usage: $SCRIPTNAME -n number[,number2,number3,...] [text]" | |
echo "Send a SMS message to the specified recipient number(s). The text to send is either supplied as arguments or read from stdin if no arguments are given." | |
echo " -n number(s) recipient number(s) - separate multiple numbers by commas" | |
exit 0 | |
} | |
RECIPIENTS="" | |
while getopts :hn: option | |
do | |
case "$option" in | |
h) show_usage;; | |
n) RECIPIENTS="$OPTARG";; | |
?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1; | |
esac | |
done | |
shift $((OPTIND-1)) | |
if [ -z "$RECIPIENTS" ]; then | |
echo "$SCRIPTNAME: no recipient number given"; exit 1; | |
fi | |
if [ $# = 0 ]; then | |
echo "$SCRIPTNAME: no msg given" | |
else | |
echo $RECIPIENTS | tr ',' '\n' | while read number;do | |
/data/data/com.termux/files/usr/bin/am startservice --user 0 -n com.android.shellms/.sendSMS -e contact "$number" -e msg "$*" > /dev/null | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found out, that all messages with the word "Whatsapp" in it... won't get through. Crazy times. So I changed the whatsapp link to a tiny url link... Now I can send it. Thank you Gerardo. Who would have known... that they are blocking this word. Crazy, crazy... I still can't believe it.