help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] initialize ten variables with a loop for


From: DJ Mills
Subject: Re: [Help-bash] initialize ten variables with a loop for
Date: Thu, 10 Jan 2013 14:33:14 -0500

Sounds to me like you really want an array.
And as an aside, don't use seq. It's silly.

for ((i=0; i<10; i++)); do
  el[i]=0
done



On Thu, Jan 10, 2013 at 2:18 PM, Gerard ROBIN <address@hidden> wrote:
Hello,
I want to initialize ten variables : el1, el2, ... el10 :

for i in `seq 10`; do el$i=0; done

bash: el1=0: command not found
bash: el2=0: command not found
bash: el3=0: command not found
bash: el4=0: command not found
bash: el5=0: command not found
bash: el6=0: command not found
bash: el7=0: command not found
bash: el8=0: command not found
bash: el9=0: command not found
bash: el10=0: command not found

what is wrong in what I did?

and how can I achieve that ?

Thanks.

--
Gérard



reply via email to

[Prev in Thread] Current Thread [Next in Thread]