Let me understand: you want to accomplish that with a single loop,
right? I think so, because the following two nested loops do what you
want very easily:
for((i=0;i<=30;i+=4)); do
for((j=0; j<2;j++)); do
echo "Welcome $((i+j)) times";
done;
done
Welcome 0 times
Welcome 1 times
Welcome
already solved!
$ for i in $(seq 0 4 16); do seq $i 1 $(( $i + 1 )); done
0
1
4
5
8
9
12
13
16
17
thank you!
--- On Sat, 12/11/10, Camaleón wrote:
From: Camaleón
Subject: Re: bash increment in a given way
To: debian-user@lists.debian.org
Date: Saturday, December 11, 2010, 4:57 PM
On Sat, 11
On Sat, 11 Dec 2010 06:34:14 -0800, 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 time
S Mathias wrote:
> [-- text/plain, encoding 7bit, charset: us-ascii, 28 lines --]
> 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
for i in 0 1 4 5 8 9; do
S Mathias wrote:
> $ 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:\
for i in 0 1 4 5 8 9; do "elcome $i times"; done
--
Chris Jackson
Shadowcat Systems Ltd.
--
To UNSUBSCRIB
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
6 matches
Mail list logo