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
Published at
2024-08-24 21:31:01Event JSON
{
"id": "4e17955147ceae7ad8b22912d75306c216ef8dab6df2282a7fc98cd65ff37d89",
"pubkey": "6c0bcc61825addd9ced4c4d2f2d8e9d38d9e3087ac060bff05383c5acce1a33a",
"created_at": 1724535061,
"kind": 1,
"tags": [
[
"t",
"linux"
],
[
"t",
"cli"
],
[
"proxy",
"https://chaos.social/users/scy/statuses/113019129768993644",
"activitypub"
]
],
"content": "# Which groups am I a member of?\nid -nG\n\n# Which groups is another user a member of?\nid -nG bloodninja\n\n# Is that user a member of the `wizards` group?\nid -nGz bloodninja | grep -qzxF wizards\n\nThe 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.\n\n#Linux #CLI",
"sig": "c02e0b2f920627e12f7ef650f2fda05856c21ca53e6f00fbd75851b295a25f8eb362c2249163683dd822f6d57345e6e8d8a5bb3195a1a2b7e7a93987c7a40386"
}