2007年7月4日 星期三

shell script : for loop

[will@localhost ShellScript]$ cat for.sh
#!/bin/sh

s=0

for (( i=1; i<=10; i=i+1 ))

do

s=$(($s+$i))

done

echo "The result of '1+2+3+...+10' is ==> $s"

[will@localhost ShellScript]$

沒有留言:

網誌存檔

關於我自己