text = "" # Are there any decoded parts? if numparts == 0: text = os.environ["SMS_1_TEXT"] # Get all text parts else: for i in range(1, numparts + 1): varname = "DECODED_%d_TEXT" % i if varname in os.environ: text = text + os.environ[varname]
# Do something with the text print("Number {} have sent text: {}".format(os.environ["SMS_1_NUMBER"], text))
#!/bin/bash numparts=${DECODED_PARTS} text="" if [ "$numparts" -eq 0 ]; then text=${SMS_1_TEXT} else for i in $(seq 1 $numparts); do varname="DECODED_${i}_TEXT" if [ ! -z "${!varname}" ]; then text="${text}${!varname}" fi done fi
暂无评论