Skip to content

Instantly share code, notes, and snippets.

@lephuongbg
Created August 12, 2013 03:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lephuongbg/6208142 to your computer and use it in GitHub Desktop.
Save lephuongbg/6208142 to your computer and use it in GitHub Desktop.
Send USSD Topup Query
#!/bin/bash
modem=`ussdIdent`
if [ "x" = "x$1" ]
then
echo Need to give me a top up code!
exit -1
fi
qry="*100*$1#"
echo "Sending $qry to $modem ..."
resp=`dbus-send --system --print-reply --dest=org.freedesktop.ModemManager $modem org.freedesktop.ModemManager.Modem.Gsm.Ussd.Initiate string:$qry`
resp=`echo $resp | sed 's/.* string "//' | sed 's/"//'`
echo $resp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment