f=1 read x if [ "${x:1}" == "+" ] then f=0 x=${x,,} fi while read s do if [ $f == 1 ] then s=${s,,} fi s=${s//[^$x]} echo ${#s} done //bashlinux