File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -126,11 +126,28 @@ function write_one_file {
126
126
echo " $OUTPUT_NAME ."
127
127
}
128
128
129
+ function unique_filename {
130
+ if [ ! -f " ${BLOB} " ]; then
131
+ echo " $BLOB "
132
+ else
133
+ cnt=1
134
+ while true
135
+ do
136
+ fn=" ${BLOB} ~${cnt} "
137
+ if [ ! -f " ${fn} " ]; then
138
+ echo " ${fn} "
139
+ break
140
+ fi
141
+ cnt=$(( cnt+ 1 ))
142
+ done
143
+ fi
144
+ }
145
+
129
146
function write_recoverable {
130
147
for i in " ${! BLOBS[@]} " ; do
131
148
BLOB=${BLOBS[$i]}
132
149
FILTER_NAME=${FILENAMES[$i]}
133
- OUTPUT_NAME=${FILENAMES[$i]:- $BLOB }
150
+ OUTPUT_NAME=${FILENAMES[$i]:- $(unique_filename) }
134
151
135
152
write_one_file " $BLOB " " $FILTER_NAME " " $OUTPUT_NAME "
136
153
done
@@ -235,7 +252,7 @@ function interactive {
235
252
236
253
case " $ans " in
237
254
[yY]* )
238
- write_one_file " ${BLOB} " " " " ${BLOB} "
255
+ write_one_file " ${BLOB} " " " " $( unique_filename ) "
239
256
break
240
257
;;
241
258
[nN]* )
You can’t perform that action at this time.
0 commit comments