scy on Nostr: # Which groups am I a member of? id -nG # Which groups is another user a member of? ...
# Which groups am I a member of?
id -nG
# Which groups is another user a member of?
id -nG bloodninja
# Is that user a member of the `wizards` group?
id -nGz bloodninja | grep -qzxF wizards
The cool thing about that last command is that -z causes `id` to print the list of groups zero-delimited, and `grep` to expect its input zero-delimited. Combined with -x ("must match beginning to end") this is safe against the group name you're looking for being a substring of another one.
#Linux #CLI
id -nG
# Which groups is another user a member of?
id -nG bloodninja
# Is that user a member of the `wizards` group?
id -nGz bloodninja | grep -qzxF wizards
The cool thing about that last command is that -z causes `id` to print the list of groups zero-delimited, and `grep` to expect its input zero-delimited. Combined with -x ("must match beginning to end") this is safe against the group name you're looking for being a substring of another one.
#Linux #CLI