Get the App
SLTechnology News&Howtos  ›  Servers  › 

Use the continue command of linux to end this cycle

Shulou Source: shulou.com Published: 2022-06-02 12:44:50 09月30日 Update

This article mainly introduces the use of linux continue command to end this cycle, the article is very detailed, has a certain reference value, interested friends must read it!

The main purpose of continue is to end this loop and continue with the next for,while or until loop; you can specify which layer of the loop to continue.

Syntax format: continue

Common parameters:

Reference example

The default value of the optional parameter n for continue is 1:

For ((iposit I > 0 poster imuri -)); do for ((job3umbj > 0 posit j -); do if ((jobless 2)); then continue fi printf "% s% s\ n" ${I} ${j} done done # output result 3 3 3 1 2 3 2 1 1 1

When n is 2: jump to the outer for loop to continue execution:

For ((iposit I > 0 poster iMurb -)); do for ((Job310 j > 0 positjmure -)); do if ((jogwash 2)); then continue 2 fi printf "% s% s\ n" ${I} ${j} donedone # output result 3 3 2 3 1 3 or above is to use the linux continue command to end this cycle, thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Loops commands content parameters results references outputs values interests outer layers examples guys partners commonly used more formats uses knowledge articles industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno NVidia Microsoft Shulou Technology MariaDB