[PATCH modular 16/16] build.sh: test return code directly when using echo/grep

Gaetan Nadon memsize at videotron.ca
Fri Dec 31 08:15:40 PST 2010


Reported-by: Cyril Brulebois <kibi at debian.org>

Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
 build.sh |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/build.sh b/build.sh
index 59c4d80..bd99014 100755
--- a/build.sh
+++ b/build.sh
@@ -976,8 +976,7 @@ process_module_file() {
 	fi
 
 	# skip comment lines
-	echo "$line" | grep "^#" > /dev/null
-	if [ $? -eq 0 ]; then
+	if echo "$line" | grep '^#' > /dev/null; then
 	    continue
 	fi
 
@@ -1072,8 +1071,7 @@ required_arg() {
     fi
 
     # does the argument look like an option?
-    echo $2 | grep "^-" > /dev/null
-    if [ $? -eq 0 ]; then
+    if echo $2 | grep '^-' > /dev/null; then
 	echo "the argument '$2' of option '$1' looks like an option itself"
 	echo ""
 	usage
@@ -1215,8 +1213,7 @@ do
 	fi
 
 	# check that 'prefix' doesn't look like an option
-	echo $1 | grep "^-" > /dev/null
-	if [ $? -eq 0 ]; then
+	if echo $1 | grep '^-' > /dev/null; then
 	    echo "'prefix' appears to be an option"
 	    echo ""
 	    usage
-- 
1.6.0.4



More information about the xorg-devel mailing list