linux-tutorial/codes/shell/逻辑控制/until示例.sh

28 lines
214 B
Bash

#!/usr/bin/env bash
x=0
until [[ ${x} -ge 5 ]]; do
echo ${x}
x=`expr ${x} + 1`
done
# Output:
# 0
# 1
# 2
# 3
# 4
x=0
until echo $x
[[ $x -ge 5 ]]
do
x=$[ $x + 1 ]
done
# Output:
# 0
# 1
# 2
# 3
# 4
# 5