I am using Gammu for receiving SMS. Once received I am sending them as emails. Yet if sender ID of the SMS contains space, my script is unable to process a file. I.e.:
If the file name is IN20210409_104439_00_SOME NAME_00.txt runonreceive script uses $1 to handle the filename but it saves only IN20210409_104439_00_SOME and obviously such file doesn't exist which brings errors.
runonreceive script:
sed -i '1 i\Subject: Incoming sms\n\n' /var/spool/gammu/inbox/$1
cat /var/spool/gammu/inbox/$1 | msmtp [email protected]
So I am looking for a solution for handling full filename (with spaces) or to rename the file in that script (on-the-fly) and send out renamed SMS as email.