$ string="unix bash script tutorial"

$ string="${string//[^i]/}"; echo ${#string}
$ echo $((`echo $string|sed 's/[^i]//g'|wc -m`-1))