shell学习-读取输入

功能:读取输入,打印;如果长度小于MINLEN,那么输出空格。

#!/bin/bash
# paragraph-space.sh
# Insert a blank line between paragraphs of a single-spaced text file.
# Usage: $0 <FILENAME

MINLEN=30
while read line
do
  echo "$line"

  len=${#line}
  if [ "$len" -lt "$MINLEN" ]
    then echo
  fi
done

exit 0

读入输入行,输出,如果长度${#line}小于(lt)最小长度那么输出空格

 

posted @ 2015-10-29 22:18  快乐的小土狗  阅读(160)  评论(0编辑  收藏  举报