shell - In unix, how can I pipe the output of who into the groups command? -
i'm trying this:
say there 4 users logged unix machine, a, b, c, , d.
now, groups these guys belong to, have type out :
groups b c d.
what wondering, if there way who | groups
can pipe users logged-in groups command, print out users given along group information. however, not seem work intended - rather, above command gives group first user belongs to.
in bash, zsh, , others:
groups $(who | cut -d' ' -f 1)
Comments
Post a Comment