From: Jim Meyering Date: Wed, 16 Jul 1997 12:49:36 +0000 (+0000) Subject: Exit with status from `id' command. X-Git-Tag: SH-UTILS-1_16d~53 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=74ed7c9f94e55ea81548b1aaa91056aee7d99a14;p=thirdparty%2Fcoreutils.git Exit with status from `id' command. Don't print `$name : $groups' if id fails. Reported by Austin Donnelly. --- diff --git a/src/groups.sh b/src/groups.sh index d115d2a77f..508e95a18c 100755 --- a/src/groups.sh +++ b/src/groups.sh @@ -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