[Ilugc] BASH Script

Ashish Verma ashishverma1984 at gmail.com
Wed Dec 31 19:31:36 IST 2008


Hi All,

I am completely new to this field. I only have some knowledge of C and other
basic languages like HTML and javascript. I am trying to write an
interactive/automated script to start the VMs on my machine.

So a part of that is to list all the iso's in my system and let the user
select which one to use in the VM. I have done the following:

list_iso()
{
varX=CD
varY=0
locate *.iso > /temp/cdromlist
cat /tmp/cdromlist | while read count; do
varY=$(expr $varX + 1)
echo "$varX$varY is $count" # this displays as CD1 is /vms/rhel4.iso
#Assign the value of the path to unique variable
varZ="$varX$varY # This makes varZ equal to CD1
$varZ=$count  # Now this should make a variable CD1 hold the value
/vms/rhel4.iso just like the path variable but I get error for  this
indicating "No such file or directory".

...........
}

Please advise

Regards,
Ashish


More information about the ilugc mailing list