LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   shell scripting (https://www.linuxquestions.org/questions/linux-newbie-8/shell-scripting-636953/)

jkeertir 04-22-2008 01:00 AM

shell scripting
 
Dear All,

Can anyone help me to access the value of var$i in shell scripting.

With regards,
Keerti

blacky_5251 04-22-2008 02:12 AM

In *NIX, shell variables or environment variables are prefixed with $ and followed by a name. So $i is a variable, as is $var. var$i is confusing to me in the context of your post.

If you want to see the value held by a variable, use "echo". E.g. :-
Code:

echo $i
echo $var
echo $PATH
echo $HOME


konsolebox 04-22-2008 03:21 AM

perhaps you mean
Code:

eval value=\${var${i}}
echo ${value}

or
Code:

var=var${i}
echo ${!var}



All times are GMT -5. The time now is 10:37 PM.