📄 sms2html
字号:
#!/bin/bash# This script converts a received sms file into a html file. if [ $# -ne 1 ]; then echo "Usage: sms2html filename" exit 1fiif grep "Alphabet:.*UCS" $1 >/dev/null; then ucs2="true"else ucs2="false"fi# Write HTML headerecho "<html><body>"# Write Header of the SMS fileecho "<b>"while read line; do if [ -z "$line" ]; then break else echo "$line<br>" fidone < $1echo "</b>"# Write message textecho "<p>"if [ "$ucs2" = "true" ]; then text=`od -t x1 $1 | cut -c8-99` position="first" foundstart="false" previous="" for character in $text; do # Search for the start of the 16 bit part. Starts after "0a 0a" if [ "$foundstart" = "false" ]; then if [ "$character" = "0a" ] && [ "$previous" = "0a" ]; then foundstart="true" fi else # Combine two bytes to one 16bit character in html syntax if [ "$position" = "first" ]; then echo -en "&#x$character" position="second" else echo -en "$character;" position="first" fi fi previous="$character" doneelse text=`formail -I "" < $1` echo "$text"fi# Write HTML footerecho ""echo "</body></html>"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -