quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] [PATCH] Optimize function is_numeric


From: Jean Delvare
Subject: [Quilt-dev] [PATCH] Optimize function is_numeric
Date: Wed, 15 Oct 2014 18:20:10 +0200

The same test can be implemented using only shell code, saving the
cost of piping to an external command.
---
 quilt/scripts/patchfns.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -356,7 +356,7 @@ top_patch()
 
 is_numeric()
 {
-       echo $1 | grep -q '^[0-9]*$'
+       [[ "$1" =~ ^[0-9]+$ ]]
 }
 
 is_applied()

-- 
Jean Delvare
SUSE L3 Support




reply via email to

[Prev in Thread] Current Thread [Next in Thread]