I have a cache in the filesystem which I implemented this way.
To store a value I do something like
echo ""$KEY1"_"$KEY2"="$VALUE" >> $CACHE_DIR/$INDEX.cache
To get a value, first I source the cache file:
source $CACHE_DIR/$INDEX.cache
and then I echo the
"$KEY1"_"$KEY2"
Cache example:
foo1_foo2=wohohhowwho
The problem with this, is that I have some keys that have a "/" in it, so when I have this:
foo3_foo/4=wohohhowwho
and source the file, it says
cache/15637.cache: line 1: foo3_foo/4=wohohhowwho: No such file or directory
because of the /
.
Is there an option to the source command to not search in the path for files and only take in count the content as vars? I could escape the /
, but is there another way?