title: bash script that reads each line of a file and stores to different variables (but got command not found message)
body: <p>Thanks for your help in advance.  I'm writing a simple bash script, which just read each line of a file, and then store each line into a different variable.  For example, I'd like the script to perform the following commands:</p>
  
  <pre><code>d1=AER
  d2=BHR
  d3=CEF
  ...
  </code></pre>
  
  <p>Therefore, I have a text file that has 10 lines, and each line is the content of the variables I'd like to store (e.g., AER), and I have the following test.sh script:</p>
  
  <pre><code>#!/bin/bash
  for i in {1..10..1}
  do
      $(d$i=$(sed -n ${i}p $HOME/textfile.txt))
  done
  </code></pre>
  
  <p>However,when executing the script, it gave me</p>
  
  <pre><code>./test.sh: line 4: d1=AER: command not found
  ./test.sh: line 4: d2=BHR: command not found
  ./test.sh: line 4: d3=CEF: command not found
  ...
  </code></pre>
  
  <p>,instead of storing the characters into corresponding variables.  Could somebody please identify where I did it wrong?  Thank you so much!</p>