I need to generate new directories in incremental fashion. Below is the folder structure:-
1. Dockerfile
2. Makefile
3. manifests
+ 1.0.0
+ 1.0.1
I want to fetch the latest version from the existing directories in a variable i.e. last=1.0.1, add the value 0.0.1 to last to get the next version i.e next=1.0.2. So that I can create a new directory using mkdir manifests/$next, something like this:-
1. Dockerfile
2. Makefile
3. manifests
+ 1.0.0
+ 1.0.1
+ 1.0.2
I am able to fetch the directory name with the latest version using the below command:-
last=$(find manifests -type d -name '[0-9]*.[0-9]*.[0-9]*' -printf "%f\n" | sort -V | tail -n 1)
How do I add 0.0.1 to the variable, so that next=1.0.2 something like this:-
next=$(($last + 0.0.1))