[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Broadcast email to all my users



On Wed Mar 12 2003 at 21:30, Michael Fratoni wrote:

> You can do this easily with a short script and a text file containing the
> mail message. Something like:
> 
> $ cat mail.sh
> #!/bin/sh
> 
> USERS=`cat /etc/passwd | awk -F: '$3 > 499 { print $1 }'`

  (BTW, that is a "Useless Use Of Cat" :-)

You only want to glob real users, so it needs to be filtered so that
the system users are not included.  Try something like this (which
is a quick hack that seems to work for me)...

USERS="$(grep -vE ':[0-9][0-9]:[0-9]*:|:[0-9]:[0-9]*:|Anonymous' /etc/passwd |  awk -F: '$3 > 499 { print $1 }'

(Or somehow restrict the output just to those users who have an ID
within the relevent range).

Cheers
Tony





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]