# !bin/bash
echo "enter a number"
read a
b=0
while [ "$b" -lt "$a" ]
do
q=$b
sum=0
while [ "$q" -gt 0 ]
do
r=`expr $q % 10`
q=`expr $q / 10`
sum=`expr $sum + $r /* $r /*$r`
done
if [ $((sum)) -eq $b ]
then
echo " $b is armstrong number"
fi
b=`expr $b + 1`
done
答案1
在第一行你有
# !bin/bash
代替
#!/bin/bash