View Single Post
  #5   (View Single Post)  
Old 12th March 2012
aleunix aleunix is offline
Real Name: Alessandro
Spam Deminer
Join Date: May 2008
Location: Italy
Posts: 224

Now i'm on OpenBSD so i don't check it but i think you have right.

Now i was thinking at something sufficient general for avoid to use seq or jot that can be work on OpenBSD and Linux without modification of the code.
These attempt failed:
for i in {$1.. $2}
for ((i=$1; i <= $2 ; i++))
so, in the end, now i'm using that approach:
while [ "$i" -le $2 ]
echo $i
let "i+=1"
I haven't check on Linux but given that i make this change while see it:
Example 11-17. C-style syntax in a while loop from the Advanced Bash-Scripting Guide
i suppose that should work.
Reply With Quote