[CentOS] bash increment in a given way

Stephen Harris lists at spuddy.org
Sat Dec 11 14:41:46 UTC 2010


On Sat, Dec 11, 2010 at 06:34:25AM -0800, S Mathias wrote:

> # {START..END..INCREMENT}
> $ for i in {0..10..2}; do echo "Welcome $i times"; done

> but what's the "magic" for this? :
> 
> $ MAGIC; do echo "Welcome $i times"; done
> Welcome 0 times
> Welcome 1 times
> Welcome 4 times
> Welcome 5 times
> Welcome 8 times
> Welcome 9 times

You might just have to hard-code the sequence:

  for i in 0 1 4 5 8 9; do ....

-- 

rgds
Stephen



More information about the CentOS mailing list