Re: shell script output

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

 



On Fri, 2006-11-24 at 14:44 +0530, Kaushal Shriyan wrote:
> Hi
> 
> Below is my script
> 
> ##########################################
> #!/bin/bash
> 
> v1=20
> v2=30
> v3=40
> 
> i=1
> 
> for i in 1 2 3
> do
> echo  $'v'$i''
> done
> 
> ##########################################
> 
> I want to print the values of v1,v2 and v3
> 
> Thanks
> 
> Kaushal

How about:
#############################
#!/bin/bash

v[1]=20
v[2]=30
v[3]=40

for i in 1 2 3
do
echo  ${v[$i]}
done
#############################

Matt Davey		You can't have everything.  Where would you put it?
mcdavey@xxxxxxxxxxxxxx 		  -- Steve Wright


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux