Send SMS using Android ADB

After a great deal of searching through Android documentation, I’ve made a simple shell script that’ll send SMS!
To send, run this script with argument 1 as the phone number(in CCIIXXXXXXX format C is for country code and I is for company code) and argument 2 as the message. Use “” if you have spaces in it.

#! /bin/bash
# Send text through adb by Madura A.
# Please use the above app(or similar) to keep it from locking while
# using this script

# FIX: Android 4.1.1 suggested by samox86

$ADB shell am start -a android.intent.action.SENDTO -d sms:$1 --es sms_body "$2" --ez exit_on_sent true
sleep 1
$ADB shell input keyevent 22
sleep 1
$ADB shell input keyevent 66

Change $ADB according to where you’ve installed ADB. Make sure you’ve configured ADB(obviously!).