bash increment in a given way
Neil Cherry
ncherry at linuxha.com
Sun Dec 12 17:39:06 UTC 2010
On 12/11/2010 09:34 AM, S Mathias wrote:
> It's ok, that i can use this, when i want an incrementing sequence, in a given way:
>
> # {START..END..INCREMENT}
> $ for i in {0..10..2}; do echo "Welcome $i times"; done
> Welcome 0 times
> Welcome 2 times
> Welcome 4 times
> Welcome 6 times
> Welcome 8 times
> Welcome 10 times
> $
>
> 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
> $
>
> thanks:\
>
>
Take a look at the command seq (man seq):
SYNOPSIS
seq [OPTION]... LAST
seq [OPTION]... FIRST LAST
seq [OPTION]... FIRST INCREMENT LAST
--
Linux Home Automation Neil Cherry ncherry at linuxha.com
http://www.linuxha.com/ Main site
http://linuxha.blogspot.com/ My HA Blog
Author of: Linux Smart Homes For Dummies
More information about the ubuntu-users
mailing list