2007年7月4日 星期三

shell script : while loop

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

s=0

i=0

while [ "$i" != "10" ]

do


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

done

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

[will@localhost ShellScript]$

沒有留言:

網誌存檔

關於我自己