读取参数

5年以前  |  阅读数:488 次  |  编程语言:Shell 
#!/bin/bash

# using one command line parameter

factorial=1
for (( number = 1; number <= $1; number++))
do
    factorial=$[ $factorial * $number ]
done
echo The factor of $1 is $factorial

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8