mail-format.sh

来自「Shall高级编程」· Shell 代码 · 共 51 行

SH
51
字号
#!/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 + =
减小字号Ctrl + -
显示快捷键?