vim test.sh
read -p "Enter a number:" factorial=1 for (( count=1; count<=$REPLY; count++)) do factorial=$[ $factorial * $count ] done echo "The factorial of $REPLY is $factorial" # chmod +x test.sh # ./test.sh Enter a number:6 The factorial of 6 is 720 --THE END--文章标题:Linux Bash编程
本文作者:hiyo
本文链接:https://www.cnblogs.com/hiyong/p/14238495.html
欢迎关注公众号:「测试开发小记」及时接收最新技术文章!