0

Can anyone help me with a for loop? For example, if I wanted values from 1 to 5, 8 to 11, and 13 to 15, I tried this:

for value in {1..5;8..11;13..15}
do
echo $value
done

This is not working.

3

You can do a sequence of {N..M}:

for i in {1..5} {11..13} 15; do
    echo $i
done

Will result in:

1
2
3
4
5
11
12
13
15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.