[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: r37445 - in trunk/packages/lvmcfg: debian



On Fri, May 19, 2006 at 10:52:15PM +0200, Frans Pop wrote:
On Friday 19 May 2006 17:53, David Härdeman wrote:
 # Convert common terms for disk sizes into something LVM understands.
+#  e.g. "200 Gb" -> "200G"
 #
 human2lvm() {
-    input="$1"
-    input=`echo "$input" | sed -e 's/ \+KB/K/'`
-    input=`echo "$input" | sed -e 's/ \+MB/M/'`
-    input=`echo "$input" | sed -e 's/ \+GB/G/'`
-    input=`echo "$input" | sed -e 's/ \+TB/T/'`
-    input=`echo "$input" | sed -e 's/ \+\(.\)/\1/'`
-    echo "$input"
+	echo "$1" | tr -d " " | sed -e 's/\([kmgtKMGT]\)[bB]/\1/'
 }

There is one thing I do not understand about this patch.
I looks as if the size multiplier (KMGT) should be uppercase and the new patch supports both lowercase and uppercase. On the other hand, the last old line seems to accept any one-character size multiplier.

A short explanation would be welcome.

The LVM tools expect a one-character size multiplier, but it is not case-sensitive.



Reply to: