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:
d1=AER d2=BHR d3=CEF ... 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:
#!/bin/bash for i in {1..10..1} do $(d$i=$(sed -n ${i}p $HOME/textfile.txt)) done However,when executing the script, it gave me
./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 ... ,instead of storing the characters into corresponding variables. Could somebody please identify where I did it wrong? Thank you so much!