I'm new to scripting, so far I've created this:
#!/bin/sh
(
echo List of users in PRD
echo $(date)
cat /etc/passwd | awk -F: '{print $1,$3,$5}' | sort | \
while read username uid gecos
do
echo "${username}:${uid}:${gecos}"
done
) > `hostname`_userlogins.txt
mailx -s file [email protected] < `hostname`_userlogins.txt
This gives a list of all users. I have another file (called ignore.txt) which has list of users to be excluded before sending the email out.
How do I link the list with ignore.txt to filter?