Below is my script and I want it to read a file in order to save it to a variable.
I want to read a file and save it in a variable, but I need to keep the variable and not just print out the file. How can I do this? I have written this script but it isn't quite what I needed:
#!/bin/sh
while read LINE
do
echo $LINE
done <$1
echo 11111-----------
echo $LINE
My script takes a filename as a parameter which contains “aaaa”, the output would be
aaaa
11111-----
Can anyone tell me how to save it to a variable instead of printing it?