读取文件,每行拆分,并比较拆分数组长度
#!/bin/bash FILENAME=./.txt function While_read_LINE(){
cat $FILENAME | while read LINE
do
str=$LINE
OLD_IFS="$IFS"
IFS=";"
arr=($str)
IFS="$OLD_IFS" lineLen=${#arr[@]}
minLen=
if [ $lineLen -le $minLen ];then
echo "$LINE"
fi
done
} While_read_LINE lineLen=
minLen=
if [ $lineLen -le $minLen ]; then
echo "le"
else
echo "not le"
fi
数字判断一些命令:
#-gt是大于
#-lt是小于
#-eq是等于
#-ne是不等于
#-ge是大于等于
#-le是小于等于