2017-11-17 17:06:52 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
### 0到9之间每个数的平方
|
|
|
|
x=0
|
|
|
|
### x小于10
|
|
|
|
while [[ ${x} -lt 10 ]]; do
|
|
|
|
echo $((x * x))
|
2019-03-01 10:36:45 +08:00
|
|
|
x=$((x + 1))
|
2017-11-17 17:06:52 +08:00
|
|
|
done
|
2019-03-01 10:36:45 +08:00
|
|
|
# Output:
|
|
|
|
# 0
|
|
|
|
# 1
|
|
|
|
# 4
|
|
|
|
# 9
|
|
|
|
# 16
|
|
|
|
# 25
|
|
|
|
# 36
|
|
|
|
# 49
|
|
|
|
# 64
|
|
|
|
# 81
|