Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2008
    Posts
    7

    Unanswered: How to concatenate a string and a variable

    I need a way to build variable in this manner:

    variable_$i
    Inside a for loop i need to create it.
    where i goes from 1 to 30..
    and then i need to print them on screen with echo $variable_$i
    which is the best way to do this?

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    A simple loop will do:
    Code:
    i=1
    while [ $i -le 30 ]; do
        echo $i
        i=$[$i+1]
    done
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •