don't stumble over single quotes when sending SMS texts and replace double quotes with double single quotes to avoid trouble (a bit patchy)
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
parent
f539e45459
commit
00846a1608
1 changed files with 5 additions and 1 deletions
|
@ -34,8 +34,12 @@ else
|
|||
fi
|
||||
TEXTSIZE="${#TEXT}"
|
||||
|
||||
#mmcli doesn't appear to be able to interpret a proper escape
|
||||
#mechanism, so we'll substitute double quotes for two single quotes
|
||||
SAFE_TEXT=$(echo "$TEXT" | sed "s/\"/''/g")
|
||||
|
||||
SMSNO="$(
|
||||
mmcli -m "$MODEM" --messaging-create-sms="text='$TEXT',number=$NUMBER" |
|
||||
mmcli -m "$MODEM" --messaging-create-sms="text=\"$SAFE_TEXT\",number=$NUMBER" |
|
||||
grep -o "[0-9]*$"
|
||||
)"
|
||||
mmcli -s "${SMSNO}" --send || err "Couldn't send text message"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue