Skip to content

Instantly share code, notes, and snippets.

@artizirk
Last active December 3, 2022 20:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save artizirk/6307533 to your computer and use it in GitHub Desktop.
Save artizirk/6307533 to your computer and use it in GitHub Desktop.
send sms with ppp chat program
#!/bin/ash
#using: sendsms +375555555 "some text i want to send"
TELFNUMB=$1
SMSTEXT=$2
MODEM="/dev/ttyUSB1"
#reg to the network (maybe not needed)
gcom reg -d $MODEM
# Set modem speed
stty -F $MODEM ispeed 9600
#send some AT commands to the modem and hope that it works
chat TIMEOUT 1 "" "AT" "OK" > $MODEM
chat TIMEOUT 1 "" "AT+CMGF=1" "OK" > $MODEM
chat TIMEOUT 1 "" "AT+CMGS=\"$TELFNUMB\"" "OK" > $MODEM
chat TIMEOUT 1 "" "$SMSTEXT" "OK" > $MODEM
chat TIMEOUT 1 "" "^Z" "OK" > $MODEM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment