[K12OSN] How about a scripting question :-)

Dan Young dyoung at mesd.k12.or.us
Fri Nov 10 16:13:14 UTC 2006


Mike Oliveri wrote:
> Why not just use > instead of >>? > should replace the file rather than
> append, and then you wouldn't need to remove the file, either.

Yeah that's better, just have to move the redirection out of the loop:

#!/bin/sh
MAILUSERS=$(getent group staff | cut -d':' -f4 | sed 's/,/ /g')
for EACH in $MAILUSERS; do
   echo "$EACH at winonacotter.org OK"
done > /etc/mailusers
postmap hash:/etc/mailusers

-- 
Dan Young <dyoung at mesd.k12.or.us>
Multnomah ESD - Technology Services
503-257-1562




More information about the K12OSN mailing list