摘要: #!/bin/bash # sum.sh # 获取随机数量的参数,相加并打印结果 # total=0 # # $# 表示参数的数量 # for 循环获取每个参数 # ${!i} 表示返回第i个参数 # for (( i = 1; i <= $#; i++ )) do total=$[ $total + ${!i} ] done # echo Total = $total # #!/bin/bash 阅读全文
posted @ 2019-09-15 13:29 no樂on 阅读(895) 评论(0) 推荐(0) 编辑