<font face="courier new,monospace"><br></font><br><div class="gmail_quote">On 11 December 2010 14:34, S Mathias <span dir="ltr"><<a href="mailto:smathias1972@yahoo.com">smathias1972@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<table cellpadding="0" cellspacing="0" border="0"><tbody><tr><td style="font: inherit;" valign="top">It's ok, that i can use this, when i want an incrementing sequence, in a given way:<br><br># {START..END..INCREMENT}<br>
$ for i in {0..10..2}; do echo "Welcome $i times"; done<br>Welcome 0 times<br>Welcome 2 times<br>Welcome 4 times<br>Welcome 6 times<br>Welcome 8 times<br>Welcome 10 times<br>$<br><br>but what's the "magic" for this? :<br>
<br>$ MAGIC; do echo "Welcome $i times"; done<br>Welcome 0 times<br>Welcome 1 times<br>Welcome 4 times<br>Welcome 5 times<br>Welcome 8 times<br>Welcome 9 times<br>$<br></td></tr></tbody></table></blockquote><div>
<br>All you need to do is work out the function behind the sequence. To generate this particular sequence, you need 2 loops, and outer one counting from 0..2 and an inner one counting between 0..1:<br><br>for n in {0..2};<br>
do<br> for m in {0..1};<br> do<br> echo "Welcome $(((n * 4) + m)) times";<br> done;<br>done;<br><br>or, in one line: <br><br>for n in {0..2}; do for m in {0..1}; do echo "Welcome $(((n * 4) + m)) times"; done; done; <br>
</div></div><br>-- <br>Sam<br>