sms2xml

来自「GSM猫管理程序」· 代码 · 共 23 行

TXT
23
字号
#!/bin/sh#This script converts a received text message to XML.#Written by Thomas Dolberg, October 2005#run this script only when a message was received.if [ "$1" != "RECEIVED" ]; then exit; fi;#Extract data from the SMS fileFROM=`formail -zx From: < $2`TEXT=`formail -I "" <$2 | sed -e"1d"`#Save as XML#for some reason the mktemp-command creates two instances of the file if I add the .xml-extension to the FILENAME-variable.FILENAME=`mktemp /var/spool/sms/XML/answerXXXXXX`echo "<?xml version='1.0'?>" >$FILENAME.xmlecho "<SMS>" >>$FILENAME.xmlecho "  <from>$FROM</from>" >>$FILENAME.xmlecho "  <message>$TEXT</message>" >>$FILENAME.xmlecho "</SMS>" >>$FILENAME.xml#Delete the original file without the .xml-extensionrm $FILENAME

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?