GNU bug report logs - #9987
RFE: 'groups' command ADD command switches "-0", and "-1"

Previous Next

Package: coreutils;

Reported by: Linda Walsh <coreutils <at> tlinx.org>

Date: Mon, 7 Nov 2011 22:31:01 UTC

Severity: normal

Merged with 12083

Done: Bernhard Voelker <mail <at> bernhard-voelker.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 9987 <at> debbugs.gnu.org
Subject: bug#9987: [PATCH] groups,id: add -0, --null option
Date: Sat, 21 Sep 2013 12:15:11 +0200
[Message part 1 (text/plain, inline)]
On 09/19/2013 11:53 AM, Pádraig Brady wrote:
> So I'd avoid getent entirely and do:

Good idea.

> # Add $USER to ensure we have at least one explicit entry
> users="$u"
> # Add 'root' to test multiple groups (as is usually the case)
> id root >/dev/null 2>/dev/null && users="$USERS root"
> # Add 'nobody' to test single group (as is usually the case)
> id nobody >/dev/null 2>/dev/null && users="$USERS nobody"
> # Add $users and '' (implicit $USER) to list to process
> printf '%s\n' $users '' >> users || framework_failure_

Interestingly, the situation is different here (openSUSE):
root is only in group root, and nobody is in the groups
nobody and nogroup.
However, I've added some users which seem to be typical
for being member of one or more groups.

  for u in root man postfix sshd nobody ; do
    id $u >/dev/null 2>&1 && users="$users $u"
  done

New patch attached.  Thanks!

Have a nice day,
Berny
[id-zero-option-v2.patch (text/x-patch, attachment)]

This bug report was last modified 11 years and 300 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.