On Mon, 21 Jul 2008 08:46:14 +0200, Valerio Pachera <[EMAIL PROTECTED]>
wrote:
Hi all, may you write me how to get (for example) the list of all the
teachers?
I mean by bash, not by LWAT.
I need that for a script.
Thankyou.
Try:
getent group teachers |cut -d: -f4 |tr ',' '\n'
[getent group teachers] will also list name of group, gid, users etc, but
you probably just want the usernames. So piping the output to [cut -d:
-f4] will show only the 4th field, the 4th field being the user names. The
users will then be listed on one line, separated by commas. Then when you
add [tr ',' '\n'] it translates all commas to new lines, so the result
will be a list with all users in teachers group, each username on a new
line
teacher1
teacher2
teacher3
Bjarne
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]