I have been reading lines from a file I created and would like to use a variable and avoid writing to storage. Not sure if this can easily be done. The working code starts off as follows
sensors | grep "Core" > temp.tmp
input=./temp.tmp
while IFS= read -r line
do
--etc--
done < "$input"
The above works fine but I need to find a good location for the temp file and thought I could just avoid writing to storage altogether. Tried the following
input=`sensors | grep "Core"`
while IFS= read -r line
do
--etc--
done < "$input"
This did not work as the newline delimiters were removed and the variable has a huge "line" that is read in all at once. The variable string has ")" that end in the correct place to be used as a delimiter but the "read" keys on newline. Any easy fix?
..thanks for looking...
/tmp/
and such things are usually done withtmpFile=$(mktemp); command > "$tmpFile"
.