Hi I need help in making a script where I will read from a txt file.
In this file each line should be read and saved as a new variable like var1, var2 etc.
I have tried this code:
#!/bin/sh
while read LINE
do
var1=$(echo $LINE)
echo $var1
var
done < FILE.txt
This will read the file (FILE.txt) and list the content of each line on the screen, but I need to assign each line to a new variable.
The content of FILE.txt
CONTENT_A
CONTENT_B
CONTENT_C
etc
And the output I would like would be:
var1=CONTENT_A
var2=CONTENT_B
var3=CONTENT_C
etc..
Thanks
Steen