當前位置:編程學習大全網 - 電腦編程 - 編寫壹個shell腳本程序,從命令行輸入10個數

編寫壹個shell腳本程序,從命令行輸入10個數

#!/bin/bash

all=$*

if?[?$#?-ne?10?];then

echo?error|tee?-a?/tmp/err

exit?1

fi

sum=1

for?i?in?$all

do

if?[?$i?-le?0?];then

echo?error|tee?-a?/tmp/err

exit?1

else

sum=`expr?$sum?\*?$i`

fi

done

echo?$sum

  • 上一篇:cclink模塊可以接觸摸屏嗎
  • 下一篇:華為matebookE能制作網頁嘛
  • copyright 2024編程學習大全網