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? :
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 UNSUBSCRIBE, email to
S Mathias smathias1...@yahoo.com 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
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 times
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 noela...@gmail.com wrote:
From: Camaleón noela...@gmail.com
Subject: Re: bash increment in a given way
To: debian-user@lists.debian.org
Date: Saturday
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; j2;j++)); do
echo Welcome $((i+j)) times;
done;
done
Welcome 0 times
Welcome 1 times
Welcome 4
6 matches
Mail list logo