On Thu, Feb 15, 2018 at 3:34 PM, Stevens <fred-n-sandy@myrhinomail.com> wrote:
A stupidly simple but not terribly accurate answer is: #> less /etc/passwd |grep <users group number>
I say not terribly accurate because in my system, users group is 100 and grep returns not only 100 but anything with 100 in it. You did say without parsing files. That is as close as I can get without more coffee.
The problem in your example is not parsing. My GID can come from, for example, LDAP. In that case you will get nothing. I found this solution:
getent passwd | awk -F: '{if($4=='$gid')print $1}'
But I still have some problems. One of these is - how to convert name to number clear. I don't want to parse /etc/group for that. And I ask myself all the time - why there is no clear solution for that? It's hard to believe that this simple task can be solved only by parsing... -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org