I have searched for an elegant solution, without luck. Ultimately, I need to create a number of unique id's (on a single machine) of a fixed length (of 3 characters) that begin with a letter, and contains only numbers or uppercase letters. (e.g. AXX, where X can be a number or letter)
I am using the mktemp utility to generate the unique ids. The problem: mktemp creates temporary filenames which are case sensitive.
Currently, I store each temporary file generated in a diretory, "GeneratedFile". I then create a case insensitive version of the file, and store it in a directory, "ExistingID". Each time I call mktemp, I check to see if the generated file has a case insensitive counterpart in the ExistingID directory. If it does, I continue to call mktemp until I generate a filename that isn't currently in use as a unique ID.
Is there a better way to do this?