sendsms

bash skript pro poslani sms pres GSM usb modem

# cat sendsms
#!/bin/bash
#usage: sendsms <mobile number> <text to send>
sm_number=${1:?"missing arg 1 for <mobile number>"}

sm_text=""

if [[ -p /dev/stdin ]]
    then
    sm_text=$(cat -)
fi

if [ "$sm_text x" == " x" ]
  then
    sm_text=${2:?"missing arg 2 for <text to send>"}
fi

printf "AT+CMGF=1\r\nAT+CMGS=\"$sm_number\"\r\n$sm_text\x1a" > /dev/ttyUSB3
Tisk/export