#!/bin/bash
var=$1
len=${#var}
j=0
for(($j;$j<$len;((j++))))
do
if [ ${var:$j:1} -eq 0 ]
then
echo "第$j位数字是0"
elif [ ${var:$j:1 } -eq 1 ]
then
echo "第$j位数字是1"
elif [ ${var:$j:1} -eq 2 ]
then
echo "第$j位数字是2"
elif [ ${var:$j:1} -eq 3 ]
then
echo "第$j位数字是3"
elif [ ${var:$j:1} -eq 4 ]
then
echo "第$j位数字是4"
elif [ ${var:$j:1} -eq 5 ]
then
echo "第$j位数字是5"
elif [ ${var:$j:1} -eq 6 ]
then
echo "第$j位数字是6"
elif [ ${var:$j:1} -eq 7 ]
then
echo "第$j位数字是7"
elif [ ${var:$j:1} -eq 8 ]
then
echo "第$j位数字是8"
elif [ ${var:$j:1} -eq 9 ]
then
echo "第$j位数字是9"
else
echo "input error,please input number"
exit
fi
done
echo "the number is $var"