[K12OSN] How about a scripting question :-)

Huck dhuckaby at paasda.org
Thu Nov 9 22:20:59 UTC 2006


touch /etc/mailusers

creates the file 'mailusers' in /etc

--Huck

Jim Kronebusch wrote:
>> The last user in the group doesn't have a comma after their name to 
>> be substituted w/ "@winonacotter.org OK". How about:
>>
>> #!/bin/sh
>> if [-f /etc/mailusers]; then rm -f /etc/mailusers; fi
>> touch /etc/mailusers
>> MAILUSERS=$(getent group staff | cut -d':' -f4 | sed 's/,/ /g')
>> for EACH in $MAILUSERS; do
>>   echo "$EACH at winonacotter.org OK" >> /etc/mailusers;
>> done

> Anyhow when things weren't working I dumped the touch portion as well since I
> didn't know what it did. I figured if the rm command ran, touch wouldn't be
> able to find /etc/mailusers anyhow.  




More information about the K12OSN mailing list