Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the until command of Shell

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the Shell until command how to use the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that we read this Shell until command how to use the article will have a harvest, let's take a look.

The until command works the exact opposite of the while command. The until command specifies a test command that usually returns a non-zero exit status code. When the exit status code of the test command is not 0, Bash Shell executes the command in the loop; when the exit status code of the test command is 0, the loop ends.

Until syntax format: until conditiondo commanddone

Condition is generally a conditional expression, and if the return value is false, the statement inside the loop continues to be executed, otherwise it jumps out of the loop.

For the following example, we use the until command to output numbers from 0 to 9:

#! / bin/basha=0until [! $a-lt 10] do echo $a = `expr $a + 1`done run result:

The output is as follows:

0123456789 this is the end of the article on "how to use the until command of Shell". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to use the until command of Shell". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report