Is there a do-while loop in bash? -


this question has answer here:

is there do-while loop in bash?

i know how program while loop in bash:

while [[ condition ]];     body done 

is there similar construct, do-while loop, body executed @ least once irrespective of while condition?

while loops flexible enough serve do-while loops:

while    body   condition true; done 

for example, ask input , loop until it's integer, can use:

while   echo "enter number: "   read n   [[ -z $n || $n == *[^0-9]* ]] true; done 

this better normal do-while loops, because can have commands executed after first iteration: replace true echo "please enter valid number".


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -