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)最小长度那么输出空格

原文地址:https://www.cnblogs.com/wenwangt/p/4921979.html