How do you do a while loop in bash?

How do you do a while loop in bash?
Answer
In bash, while loops are written like this:
  1. while [condition] do [run commands] done.
  2. while [[ $found == false ]] do echo “Insert your password.” read password done.
  3. if [[ $password == “test” ]]; then echo “You’ve entered the correct password.” found=true else echo “Your password is incorrect.” fi.
 

Tìm kiếm

Back
Top