until

执行结果命令,只要测试命令的退出状态不为零。

语法

  until test-commands; do consequent-commands; done

返回状态是在后续命令中执行的最后一个命令的退出状态,如果没有执行则返回零。

until 命令实例:

linux命令:until foo some args; do echo "crashed: $? respawning..." >&2; sleep 10; done done 10; sleep >&2; respawning..." $? "crashed: echo do args; some foo until until foo some args; do echo "crashed: $? respawning..." >&2; sleep 10; donerootopen.com
linux命令:until foo some args; do echo "crashed: $? respawning..." >&2; sleep 10; done done 10; sleep >&2; respawning..." $? "crashed: echo do args; some foo until until foo some args; do echo "crashed: $? respawning..." >&2; sleep 10; donerootopen.com
2018-03-28 15:19:48

linux命令:until (ssh root@10.1.1.39 2> /dev/null); do date; sleep 15; done done 15; sleep date; do /dev/null); 2> root@10.1.1.39 (ssh until until (ssh root@10.1.1.39 2> /dev/null); do date; sleep 15; donerootopen.com
linux命令:until (ssh root@10.1.1.39 2> /dev/null); do date; sleep 15; done done 15; sleep date; do /dev/null); 2> root@10.1.1.39 (ssh until until (ssh root@10.1.1.39 2> /dev/null); do date; sleep 15; donerootopen.com
2018-02-03 07:38:48

linux命令:until ping -c1 ADDRESS;do true;done;zenity --warning --text "ADDRESS is back" back" is "ADDRESS --text --warning true;done;zenity ADDRESS;do -c1 ping until until ping -c1 ADDRESS;do true;done;zenity --warning --text "ADDRESS is back"rootopen.com
linux命令:until ping -c1 ADDRESS;do true;done;zenity --warning --text "ADDRESS is back" back" is "ADDRESS --text --warning true;done;zenity ADDRESS;do -c1 ping until until ping -c1 ADDRESS;do true;done;zenity --warning --text "ADDRESS is back"rootopen.com
2018-04-02 08:40:48

linux命令:until !!; do done done do !!; until until !!; do donerootopen.com
linux命令:until !!; do done done do !!; until until !!; do donerootopen.com
2018-03-22 15:51:48

linux命令:until !!; do :; done done :; do !!; until until !!; do :; donerootopen.com
linux命令:until !!; do :; done done :; do !!; until until !!; do :; donerootopen.com
2018-02-03 18:58:48

Linux的Bash命令行(A-Z排序)