1

I want to specify a list of non-consecutive numbers on the command line, like so:

for i in (50 89 132 17 55); do
      echo $i
done

How do I specify the list so that $i takes each of the values in turn?

1 Answer 1

6

Just skip the parentheses.

for i in 50 89 132 17 55; do
      echo $i
done
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.