一个文件能写的,为什么要写成两个文件?
#!/bin/bash
read -p "Please enter the first number:" num1
read -p "Please enter the second number:" num2
c=0
if [ $num1 -gt $num2 ]
then
i="$num2"
j="$num1"
else
i="$num1"
j="$num2"
fi
while [ $i -le $j ]
do
if [ `expr $i % 2` -ne 0 ]
then
c=`expr $i + $c`
fi
i=`expr $i + 1`
done
echo " $num1 ~ $num2 之间奇数之和为:$c"