blob: 1f4c881f5db8ed1c5bf0fed03d19c8c171bddda1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/bash
digits=auto
mindigits=3
if [ "$digits" = "auto" ] ; then
num=$(quilt series | wc -l)
digits=$(expr length "$num")
fi
if [ $digits -le $mindigits ] ; then
digits=$mindigits
fi
quilt series | (
num=0
while read pname ; do
num=$(expr $num + 1)
bpname=$(echo "$pname" | sed 's/^[0-9]\+-\(.*\)/\1/')
if [ $digits = 0 ] ; then
npname="$bpname"
else
npname="$(printf "%.${digits}d-%s" $num "$bpname")"
fi
if [ "$pname" != "$npname" ] ; then
quilt rename -P "$pname" "$npname"
fi
done
)
|