For example:
for s in 1..5,20..23,97..99;
do
echo $s;
done
1..5,
20..23,
97..99
How to make it loop through 1,2,3,4,5,20,21,22,23,97,98,99?
You need to use brace expansion { } syntax:
for num in {1..5} {20..23} {97..99}; do
echo "$num"
done
{{1..5},{20..23},{97..99}} preventing accidents when space is missing {1..5} {20..23}{97..99} which will give you 1 2 3 4 5 2097 2098 2099 2197 2198 2199 2297 2298 2299 2397 2398 2399{{1..5},{20..23}{97..99}} would do the same.