2、编写一个Shell脚本,显示Fibonacci数列的前20项.例如:0,1,1,2,3,5,8,13,21...
问题描述:
2、编写一个Shell脚本,显示Fibonacci数列的前20项.例如:0,1,1,2,3,5,8,13,21...
答
[root@localhost baidu]# more fibonacci.sh num1=0num2=1echo $num1echo $num2couter=$(expr $1 - 2 )#echo $numwhile [ $couter -gt 0 ]dotmp=$(expr $num1 + $num2 )echo $tmpnum1=$num2num2=$tmpcoute...