todbot / blink1-tool

Command-line tools and C library for blink(1) USB RGB LED
https://blink1.thingm.com/
Other
84 stars 15 forks source link

Fix for loops to work more generally.... #25

Closed tmcarr closed 5 years ago

tmcarr commented 5 years ago

I got an interesting error message when playing with the sample scripts. I'm running Debian sid, but I don't expect anything special is happening here, and I had never seen C-style for loops like this.

I figured this was more likely to work on a broader set of hosts, so I figured i'd offer it up.

todbot commented 5 years ago

Looks good. I'll test it out this weekend. And here I thought I was doing what all the cool kids were expecting with some new bash-isms.

Do you know the difference between:

for i in $(seq 1 $n) ; do echo "$i"; done

and

for i in `seq 1 $n` ; do echo "$i"; done

Do both spawn a sub-shell? I've seen both and wonder which is preferred.