linux-tutorial/codes/shell/demos/statement/continue-demo.sh

16 lines
187 B
Bash
Raw Normal View History

2017-11-17 17:06:52 +08:00
#!/usr/bin/env bash
# 打印10以内的奇数
for (( i = 0; i < 10; i ++ )); do
if [[ $((i % 2)) -eq 0 ]]; then
continue;
fi
echo ${i}
done
2019-03-01 10:36:45 +08:00
# Output:
# 1
# 3
# 5
# 7
# 9