Indirect variable

Indirect Variable!

Variable Substitution

I had an issue where I want to substitute a variable with another variable value (example below):

DIRLIST="OCT XML GUIDES WEBSERVICES TRAVELBOUND XSLT DSE"

for i in $DIRLIST
do
        for y in ${!i}
        do
        echo $y
        done;
done;

This would make "y" equal to variable name called $OCT, $XML, $GUIDES etc..... this magic is done by:

${!VARNAME}

Browse Space

- Pages
- News
- Labels
- Attachments
- Bookmarks
- Mail
- Advanced

Explore Confluence

- Popular Labels
- Notation Guide

Your Account

Log In

 

Other Features

Add Content

- Add Comment