so i've been having to write to flat files lately and then making my script read information from the flat file and then work off of that.
i dont want to keep doing that because i believe it creates a mess. i like to keep my work all to one script instead of having that one script create temp files.
so, is there there a way to write the informationn that would have been written to a flat file to the memory and work off the memory as if it were a flat file?
assign the value to a variable and you can retreive by adding '$' at the begining of the variable name like the example below. incase, if you want to make it accessible from different processes then you can export the variable like the 2nd example.
Example 1: Variable=XXXXX
echo $Variable
Example 2:export Variable=XXXXX
echo $Variable
1: If it is discrete pieces of data like names, addresses or whatever, you can use a "sqlite" database. No engine needed, just the libraries and one database file. You'll need to know SQL of course.
2: If you're worried about leaving a mess, keep a variable with a list of the file names in it, like $TMPFILES, then at the end, just rm $TMPFILES. Another thing you can do is use $$ to create them. e.g. TMP1=/tmp/$$.tmp
You can use variables if you're not dealing with tons and tons of data.