Path: utzoo!attcan!uunet!wuarchive!zaphod.mps.ohio-state.edu!sdd.hp.com!ucsd!ucbvax!husc6!encore!zelig.encore.com From: jdarcy@zelig.encore.com (Mostly Harmless) Newsgroups: comp.unix.wizards Subject: Re: SEX! or, how do I mail to a lot of unix users? Message-ID: <11990@encore.Encore.COM> Date: 31 May 90 15:45:59 GMT References: <900531083151.30e0b91a@Csa2.LBL.Gov> Sender: news@Encore.COM Lines: 20 thermal%solgel.hepnet@CSA2.LBL.GOV: > I would like to be able to send a mail message to all the users on > a unix machine. Of course, I could do it the long way, that is, > do a 'finger' or 'who', thus getting a list of all the users, and > then sending a mail message to each, one at a time. Is there a > quicker way? The simplest way I can think of is: mail `awk -F: '{print $1;}' < /etc/passwd` This simply extracts the username field from every entry in /etc/passwd. Of course, if you're using YP you'll have to do something more like: mail `ypcat passwd | awk -F: '{print $1;}'` I'm sure you get the idea. Jeff d'Arcy, Generic Software Engineer - jdarcy@encore.com Nothing was ever achieved by accepting reality