zsh - Iterate over a range shell -


for in bar     b in 1000000             montage -geometry 500 $a-$b-*-${0..20000..1000}.png \         $a-$b-${0..20000..1000}-final.jpg     done done 

i'm unable images number 0 1000 2000 ... 20000 using $(0..20000.1000) .

is there other way in shell this?

there must no $ before {start..end..step}

% echo -{0..20000..1000}-                                     -0- -1000- -2000- -3000- -4000- -5000- -6000- -7000- -8000- -9000- -10000- -11000- -12000- -13000- -14000- -15000- -16000- -17000- -18000- -19000- -20000- 

that being said, need loop go on these numbers. word containing range replaced expansion. means command line not called each element alone, of them together. means, that, if using same range twice, expansion not conveniently combined.

compare

% echo start a-{1..3}-b a-{1..3}-b end start a-1-b a-2-b a-3-b a-1-b a-2-b a-3-b end 

and

% n in {1..3}; echo start a-$n-b a-$n-b end; done start a-1-b a-1-b end start a-2-b a-2-b end start a-3-b a-3-b end 

so in example instead of

montage -geometry 500 $a-$b-*-${0..20000..1000}.png \     $a-$b-${0..20000..1000}-final.jpg 

you want do

for n in {0..20000..1000};     montage -geometry 500 $a-$b-*-$n.png $a-$b-$n-final.jpg done 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -