Created
October 31, 2011 17:30
-
-
Save Termiux/1328084 to your computer and use it in GitHub Desktop.
mailCheck
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This scripts check if user has a proper .forward file | |
# if not present script will ask for mail and finger info | |
# on login given is on proper login folder | |
# | |
#Get user data | |
username=`whoami` | |
fullName=`finger $username | grep 'Name' | cut -d ':' -f3` | |
userHome=`finger $username | grep 'Directory' | cut -d ' ' -f2` | |
mailFile=`ls $userHome -Al | grep '.forward' | awk '{ print $9 }'` | |
mail='' | |
# | |
# Check if users mailFile is set, if not ask for mail and other data too | |
# | |
if [ ! -e $userHome/.forward ] | |
then | |
echo "Your info is not in the system please provide it" | |
chfn | |
echo "E-mail address (so we can forward all mail to you)" | |
read mail | |
echo $mail > .forward | |
echo "All done!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment