Shell script variable problem

Posted by user280288 on Stack Overflow See other posts from Stack Overflow or by user280288
Published on 2010-05-05T11:52:44Z Indexed on 2010/05/05 12:08 UTC
Read the original article Hit count: 284

Hi all,

I'm trying to write a shell script to automate a job for me. But i'm currently stuck. Here's the problem :

I have a variable named var1 (a decreasing number from 25 to 0 and another variable named var${var1} and this equals to some string. then when i try to call var${var1} in anywhere in script via echo it fails. I have tried $[var$var1], ${var$var} and many others but everytime it fails and gives the value of var1 or says operand expected error. Thanks for your help

© Stack Overflow or respective owner

Related posts about scripting

Related posts about shellscript