My system creates a new text file every time a certain event occurs.
The files should be named file_a.txt
file_b.txt
file_c.txt
etc.
In a Bash shell script,how to find out what filename should be used next?
For instance, if file_a.txt
and file_b.txt
exist but not file_c.txt
, then the next available filename is file_c.txt
.
This could be a number if it is easier.
I started designing an algorithm but there is probably an easier way?
Note: Files get removed each day, so the probability of reaching z
is zero. So, after z
any strategy is acceptable: aa
, using integers, or even using UUIDs.
z
– 123 Jun 22 '15 at 12:01