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

16 lines
187 B
Bash

#!/usr/bin/env bash
# 打印10以内的奇数
for (( i = 0; i < 10; i ++ )); do
if [[ $((i % 2)) -eq 0 ]]; then
continue;
fi
echo ${i}
done
# Output:
# 1
# 3
# 5
# 7
# 9