title: Bash - How to for-loop last digit of a variable
body: <p>I am trying to automate creation of folders. Each folder should have a number at beginning of file name (increased by the for-loop [$i]. Also the rest of the folder name should be build up by variables that are constructed as [folder_x] where [x] is supposed to be stepped up also by the loop. </p>
  
  <p><strong>To be more specific.</strong> How do you build a string that is combined by the for-loops [$i] and a variable that is called, but should at the end also use the [$i]?</p>
  
  <p>For more details see below:</p>
  
  <pre><code>#!/bin/bash
  
  # Variables to be used
  folder_1=1-folderOne
  folder_2=2-folderTwo
  folder_3=3-folderThree
  
  # This is the folder names that should be created:
    # mkdir /tmp2/1-folderOne
    # mkdir /tmp2/2-folderTwo
    # mkdir /tmp2/3-folderThree
  
  # The for loop should combine the [$i] and above [folder_x],
  # where the [x] should also be increased by the loop.
  # Below is what i have right now:
  # Note! The text "created-by-forloop" is just dummy text,
  # and should be replace by the real solution.
  
  
  for i in 1 2 3
  do
    if [ ! -d /tmp2/$i-created-by-forloop ]; then
      mkdir -p /tmp2/$i-created-by-forloop;
    fi
  done
  </code></pre>