I would like to know if it's possible to append data into a variable, rather than into a file. Although I can write information into a temporary file in /tmp, I'd rather if possible write into a variable, as I don't like the idea that should my script fail, I'll be polluting the server with messy temp files. Currently my script has a for loop containing:
echo "$line" >> $tmpdir
where $tmpdir represents a filename. Is there a way round this?