[K12OSN] How about a scripting question :-)

Jim Kronebusch jim at winonacotter.org
Thu Nov 9 21:34:15 UTC 2006


On Thu, 09 Nov 2006 13:21:06 -0800, Dan Young wrote
> Jim Kronebusch wrote:
> > Let's say I have a group called "Staff" in /etc/group with users x,y and z. 
> > How would I create a script that would grab the users from the group "Staff"
> > and create a new file "/etc/mailusers" with all the users listed separately on
> > their own line?
> 
> getent group Staff | cut -d':' -f4 | sed 's/,/\n/g' > /etc/mailusers

Here is the current script with the cleaned up command to work with the group
file directly.

#!/bin/sh
rm -f /root/mailusers
getent group staff | cut -d':' -f4 | sed -e 's/,/@winonacotter.org OK,/g' -e
's/,/\n/g' > /etc/mailusers
postmap hash:/etc/mailusers

But I still have the problem with the last user not getting the
"@winonacotter.org OK" appended.  I am stumped with that right now.

-- 
This message has been scanned for viruses and
dangerous content by the Cotter Technology 
Department, and is believed to be clean.




More information about the K12OSN mailing list