#!/bin/bash ################################################################################ # Title : CS576 Assignment 1: umail # # Name : Woodrow H. Edwards # # Date : 20091007 # # Description : Unix Accounts Mailing Lists # ################################################################################ # if no parameters are passed, set positional parameters to standard group list [ $# -eq 0 ] && set student faculty grad staff guest # for every group in the positional parameter list for g; do # extract the group number for the group from field 3 of group file gn=$(ypcat group | awk -F: -v g=$g '$1==g {print $3}') # list user name (field 1) and full name (field 3) from the passwd file # if the primary group number (field 4) matches ypcat passwd | awk -F: -v gn=$gn '$4==gn {print $1 ":" $5}' > ${g}Names # extract just the user name from previous cat ${g}Names | awk -F: '{print $1}' > ${g}Emails done