Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6861061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:29:15+00:00 2026-05-27T02:29:15+00:00

What is the real difference between while and until ? I’d like to know

  • 0

What is the real difference between while and until ?

I’d like to know if it’s possible to do an increasingly loop with “until” and a descending loop with while.

Because I saw that if I do this

COUNTER=0
     while [ $COUNTER -lt 10 ]; do
         echo The counter is $COUNTER
         let COUNTER+=1 
     done

and this

COUNTER=20
     until [ $COUNTER -lt 10 ]; do
         echo COUNTER $COUNTER
         let COUNTER-=1
     done

they work well.

But if I do the opposite, for example:

COUNTER=20
     while [ $COUNTER -lt 10 ]; do
         echo COUNTER $COUNTER
         let COUNTER-=1
     done

the script doesn’t end.

Does this means that we cannot do a reverse loop with a while in bash?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:29:16+00:00Added an answer on May 27, 2026 at 2:29 am

    while runs the loop while the condition is true. until runs the loop until the condition is true (i.e. while the condition is false).

    See http://www.gnu.org/software/bash/manual/bashref.html#Looping-Constructs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know the real difference between the two ways of type casting in
What is the real difference between these two options? What I know is: Register
What is the real difference between a C# static constructor and a Java static
When submitting an app to the app store what is the real difference between
Is there any real practical difference between java -server and java -client? All I
In C# is there any real difference (other than syntax) under the hood between:
What real (i.e. practical) difference exists between a static class and a singleton pattern?
Possible Duplicate: Real differences between “java -server” and “java -client”? I've seen the argument
Is there any real difference between the two?
What is real difference between Class and Structure when you are dealing with Object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.