File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ #
3
+ # This script inserts a blank space into kuttl test list
4
+ # (id's of test cases including and after requested will be increased)
5
+
6
+ # Check if argument is provided
7
+ if [ -z " $1 " ]
8
+ then
9
+ echo " Please provide a number of test case which number should be increased."
10
+ exit 1
11
+ fi
12
+
13
+ # Loop through the files in descending order and rename them
14
+ for file in $( ls -v -r [0-9][0-9]-* )
15
+ do
16
+ # Get the number from the beginning of the filename
17
+ number=$( echo " $file " | cut -d ' -' -f 1)
18
+
19
+ # Check if the number is greater than or equal to the argument
20
+ if [ " $number " -ge " $1 " ]
21
+ then
22
+ # Increase the number by 1 and rename the file
23
+ new_number=$( expr " $number " + 1)
24
+ new_number_padded=$( printf " %02d" " $new_number " )
25
+ new_file=$( echo " $file " | sed " s/^$number -/$new_number_padded -/" )
26
+ mv " $file " " $new_file "
27
+ fi
28
+ done
You can’t perform that action at this time.
0 commit comments