Charles Galpin wrote:
> #!/bin/sh
> #
> # get's group members
> # usage: getMembers group_name > /etc/mail/group.lst
> #
> grep `grep $1 /etc/group | cut -d: -f3` /etc/passwd | cut -d: -f1
>
> create this script, and stick a call to it for each group list you want to
> maintain in a cron job, (or a little wrapper script in say
> /etc/cron.daily), and you have a self maintaining group mail list. Add
> salt as needed.
Not bad, but not robust either. It breaks easily. How about the
following:
#!/bin/sh
TMP=`mktemp /tmp/group.XXXXXX`
grep `grep "^${1}:" /etc/group | cut -d: -f3` /etc/passwd | cut -d: -f1
> $TMP
grep "^${1}:" /etc/group | cut -d: -f4 | sed 's/,/\
/g' >> $TMP
cat $TMP | uniq
rm -f $TMP
This way, you also get those users who's default group isn't the one you
requested, but are a member of all the same.
> p.s. look bash boys - no perl! (and typed with one hand - restless baby
> in other) <grin>
Ooohh, it's sorely tempting :)
MSG
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.