📄 mail-format.sh
字号:
#!/bin/bash# mail-format.sh (ver. 1.1): Format e-mail messages.# Gets rid of carets, tabs, and also folds excessively long lines.# =================================================================# Standard Check for Script Argument(s)ARGS=1E_BADARGS=65E_NOFILE=66if [ $# -ne $ARGS ] # Correct number of arguments passed to script?then echo "Usage: `basename $0` filename" exit $E_BADARGSfiif [ -f "$1" ] # Check if file exists.then file_name=$1else echo "File \"$1\" does not exist." exit $E_NOFILEfi# =================================================================MAXWIDTH=70 # Width to fold excessively long lines to.# ---------------------------------# A variable can hold a sed script.sedscript='s/^>//s/^ *>//s/^ *//s/ *//'# ---------------------------------# Delete carets and tabs at beginning of lines,#+ then fold lines to $MAXWIDTH characters.sed "$sedscript" $1 | fold -s --width=$MAXWIDTH # -s option to "fold" #+ breaks lines at whitespace, if possible.# This script was inspired by an article in a well-known trade journal#+ extolling a 164K MS Windows utility with similar functionality.## An nice set of text processing utilities and an efficient#+ scripting language provide an alternative to bloated executables.exit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -