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: Chris F.A. Johnson
Subject: Re: [Help-bash] initialize ten variables with a loop for
Date: Thu, 10 Jan 2013 14:23:23 -0500 (EST)
User-agent: Alpine 2.00 (LMD 1167 2008-08-23)

On Thu, 10 Jan 2013, Gerard ROBIN 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 ?


eval el{1..10}=0


--
   Chris F.A. Johnson, <http://cfajohnson.com/>
   Author:
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)



reply via email to

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