PROGRAM
echo enter an 8 digit number
read d
echo enter a digit to find
read f
n=8
for((i=1;i<=n;i++))
do
k=`echo $d|cut -c $i`
if test $f -eq $k
then
cnt=`expr $cnt + 1`
fi
done
echo the number of occurrences of number $f is $cnt
OUTPUT
enter an 8 digit number
12323332
enter a digit to find
2
the number of occurrences of number 2 is 3
echo enter an 8 digit number
read d
echo enter a digit to find
read f
n=8
for((i=1;i<=n;i++))
do
k=`echo $d|cut -c $i`
if test $f -eq $k
then
cnt=`expr $cnt + 1`
fi
done
echo the number of occurrences of number $f is $cnt
OUTPUT
enter an 8 digit number
12323332
enter a digit to find
2
the number of occurrences of number 2 is 3