1

What I'm trying to do is like this:

for i in {{1..3}, {25..27}}
do
 echo $i
done

but it gives:

{1,
{2,
{3,
25}
26}
27}

I'm wondering how I can get a return as this:

1
2
3
25
26
27

2 Answers 2

5

Two ways. Drop the space after the comma or drop the entire outer brace expansion as unnecessary.

$ for i in {{1..3},{25..27}}
do
 echo $i
done

or

$ for i in {1..3} {25..27}
do
 echo $i
done
Sign up to request clarification or add additional context in comments.

Comments

3

Don't nest { and } and use it as:

for i in {1..3} {25..27}; do  echo $i; done
1
2
3
25
26
27

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.