Quote:
Originally Posted by manickaraja
Hi,
Below is the requirement. Please let me know if anyone can suggest a solution.
There is a host variable by name MOUNT1 which holds value /ora1
$ echo $MOUNT1
/ora1
Similarly there are 5 variables (MOUNT1 thorugh MOUNT5) with different mount point values. The number suffix after MOUNT (1 in above example) is coming dynamically from a varaible VAR
$ echo $VAR
1
The value of VAR will vary in a loop (first time it will be 1, second time it will be 2 etc.. after reaching 5 it will again start from 1)
Now how do I get the "/ora1" value inside the loop.
Something like echo $MOUNT$VAR. But its not simple. echo $MOUNT$VAR will not work (it will just return 1 instead of /ora1). Let me know if any of you can find the answer. Please let me know incase if you could not understand the puzzle.
|
Hi,
I'm not sure if I understand the problem but I tried the following:
Code:
for VAR in $(seq 5); do
echo $MOUNT$VAR
done
and this resulted in
Code:
/ora1
/ora2
/ora3
/ora4
/ora5
Is this the output you expected?
- If yes, are you using this loop in a script? Was MOUNT declared outside that script? Are you using pipes?
- If no, please post the code that you tried to execute