1. 程式人生 > >用shell打印下面這句話中字母數小於6的單詞

用shell打印下面這句話中字母數小於6的單詞

cte shel bsp 打印 單詞 ret nbsp 答案 ets

Bash also interprets a number of multi-character options


答案:

#! /bin/bash
for i in bash also interprets a number of multi-character options
do
n=`echo "$i" | wc -m`
if (($n<6))
then
echo $i
fi
done

用shell打印下面這句話中字母數小於6的單詞