[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash increment in a given way



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 <noelamac@gmail.com> wrote:

From: Camaleón <noelamac@gmail.com>
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 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
> 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:\

Hum... I'm not very good at "bashing" but, something like this? :-?

***
echo "Limit...?"
read limit

a=0
echo $a
for ((i=0; i<$limit; i++));
do
  a=$(($a + 1))
  echo $a
  a=$(($a + 3))
  echo $a
done
***

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: [🔎] pan.2010.12.11.16.57.10@gmail.com" target="_blank">http://lists.debian.org/[🔎] pan.2010.12.11.16.57.10@gmail.com



Reply to: