[GRASS-dev] g.mlist: minor improvements

Ivan Shmakov ivan at theory.asu.ru
Wed Feb 20 23:43:12 EST 2008


	I've somewhat improved `g.mlist' with respect to some
	``invalid'' user input cases.  Also, I've reduced off one `grep'
	invocation and replaced `grep -v '^$'' with `grep .', which is
	supposed to be somewhat faster.

scripts/g.mlist/g.mlist (do_list): More Shell quoting; reduced off one
`grep'; use `grep .' instead of `grep -v '^$''.

	Unless there're be any objections, I'm going to commit the
	change.

diff --git a/scripts/g.mlist/g.mlist b/scripts/g.mlist/g.mlist
index eed7998..a1c900d 100755
--- a/scripts/g.mlist/g.mlist
+++ b/scripts/g.mlist/g.mlist
@@ -66,14 +66,13 @@ do_list() {
 	MAPSET=""
     fi
 
-    g.list type=$type mapset=$mapset \
-	| grep -v '^-\+$' \
-	| grep -v "files available" \
+    g.list type="$type" mapset="$mapset" \
+	| grep -vE '^-+$|files available' \
 	| grep -vi "mapset" \
 	| sed 's/  */\
 /g' \
-	| grep -v '^$' \
-	| grep "$search" \
+	| grep . \
+	| grep -- "$search" \
 	| sort \
 	| sed -e "s/$/$MAPSET/"
 }



More information about the grass-dev mailing list