Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • Could you explain what using a for loop would solve here? A for loop is usually used for iterating over a static list (the shell expands the list in memory and iterates over it), while a while loop is used when the input is of indeterminate length, as when reading from a file, for example. Commented Feb 13, 2023 at 9:20
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. Commented Feb 13, 2023 at 17:19