ubuntu中實現循環的示例:
1.直接用bash解釋腳本,如:“bash ./xxx”
2.腳本例如:
#!/bin/bash
#這樣就直接指定bash解釋
read n
total=0
for((i=2;i<=$n;i+=2));do
total=$(($total+$i))
done
echo "2+...+n=$total"
echo ========================
for((i=0;i<10;i++))
do
for((j=0;jdo
echo -n "2"
done
done