The until command in Linux

Source: Internet
Author: User

The until command is just the opposite of the while command, and the until command requires a test command that typically results in a non-0 exit state, as long as the exit status of the test command is not 0,bash the shell executes the command listed in the loop, and once the test condition returns 0 exit, the loop stops!

Until Format command:

Until test commands

Do

Other Conmands

Done

Example:

#!/bin/bash

var1=10

Until [$var 1-eq 0]

Do

echo $var 1

var1=$[$var 1-2]

Done

[Email protected] ~]#./test12.sh

10

8

6

4

2




This article is from the Linux Operations sharing blog, so be sure to keep this source http://liangey.blog.51cto.com/9097868/1573952

The until command in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.