Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • thanks for the heads-up. I realized I'm actually facing a problem potentially due to folder structure. I wonder if I should edit the main text and explain what is happening... Commented Sep 16 at 15:46
  • 3
    if the proposed edit will change the nature of the question to the extent it invalidates the answers you've already received, then the preferred approach would be to ask a new question Commented Sep 16 at 17:09
  • 1
    Or just for hap in 1 2; do ...; done since the brace expansion isn't doing very much. Commented Sep 16 at 18:06
  • sure ... 1 2 is more than sufficient in this case; having said that, OP's attempt ([1:2]) kinda, sorta looks like an attempt at a range hence this answer; also, should OP decide to expand the range (eg, 1..20) then something other than for hap in 1 2 3 4 5 ... 20 is going to be more efficient, though for sufficiently large ranges (eg, 100's of K's, millions) a for loop would be suggested (eg, for ((hap=1;hap<=1000000;hap++)); do ... Commented Sep 16 at 19:03
  • and if the end of the range is stored in a variable (eg, end=20) then the brace expansion ({1..$end}) fails while the for loop would again be recommended (for ((hap=1;hap<=$end;hap++)); do ...) Commented Sep 16 at 19:19