Okay, so I've written myself a simple little script that looks for structures within volumes, and then syncs files into them as necessary.
The problem with this is that whenever it runs it causes all volumes to wake from sleep while it checks whether the target directory exists. What I'd like to do is instead only perform the check if the volume path hasn't been added a file, and to add volumes to this file if they turn out to be invalid targets.
i.e:
What is the easiest way to do this? I've worked with lists in shell scripting before, but what I really need is something more like a map where I can take the current volume path and test to see if it is in the cache file (or the contents of the file loaded into a variable).
Also, I've seen that bash4 supports a type of map/dictionary, but I'm not sure if I can use it in a shell script?
The problem with this is that whenever it runs it causes all volumes to wake from sleep while it checks whether the target directory exists. What I'd like to do is instead only perform the check if the volume path hasn't been added a file, and to add volumes to this file if they turn out to be invalid targets.
i.e:
- Load cache file into one or more variables
- For each volume:
- If volume is listed in cache file then skip it.
- Else, look to see if it has a valid target folder, if so then perform sync, otherwise add the volume to the cache file.
What is the easiest way to do this? I've worked with lists in shell scripting before, but what I really need is something more like a map where I can take the current volume path and test to see if it is in the cache file (or the contents of the file loaded into a variable).
Also, I've seen that bash4 supports a type of map/dictionary, but I'm not sure if I can use it in a shell script?