设计一个shell程序计算n的阶乘,要求: (1)从命令行接收参数n; (2)最后输出计算的结果。 $cat factorial.sh #!/bin/bash echo “Please input number:” read n result=1 i=1 while[$i -le $n] do result=`expr $i\*$result` i=`expr $i+1` done echo “The result is :$result!” $./factorial.sh Please input number: $ The result is :120!