shell script output
Matt Davey
mcdavey at mrao.cam.ac.uk
Fri Nov 24 10:10:14 UTC 2006
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 at mrao.cam.ac.uk -- Steve Wright
More information about the fedora-list
mailing list