Exit with status from `id' command.
authorJim Meyering <jim@meyering.net>
Wed, 16 Jul 1997 12:49:36 +0000 (12:49 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 16 Jul 1997 12:49:36 +0000 (12:49 +0000)
Don't print `$name : $groups' if id fails.
Reported by Austin Donnelly.

src/groups.sh

index d115d2a77fd80135f2bb6cf3782a00fbf383343c..508e95a18c4cd45650c20456241bd3029028603d 100755 (executable)
@@ -46,8 +46,12 @@ esac
 
 if [ $# -eq 0 ]; then
   id -Gn
+  status=$?
 else
   for name in "$@"; do
-    echo $name : `id -Gn -- $name`
+    groups=`id -Gn -- $name`
+    status=$?
+    test $status = 0 && echo $name : $groups
   done
 fi
+exit $status