Hi,
I am learning linux. Doing some book exercise ques.

Can someone tell me if these answers are correct.?

Thanks

1) write a bash script that, A system administrator maintains a file with birthdates of all users in /etc/birthdates. The file contains a line for each user, and is updated with the addition of every new user. Each line /etc/birthdates has the following format:

login name: real name: birthdate



#!/bin/sh

DATE=`date '+%d-%m-%y'`

USERS=`grep $DATE /etc/bithdates awk -v FS=":" '{ print $1 }'

for USER in $USERS

do

echo "Happy birthday !" | mail $USER

done



2. How to write a shell script to look into this file and send a birthday-congratulation e-mail to relevant users at 1:00 a.m. every day. Make your script as short as possible.



#!/bin/sh

DATE=`date '+%d-%m-%y'`

USERS=`grep $DATE /etc/bithdates awk -v

FS=":" '{ print $1 }'

FOR USER in $USERS

do

echo "Happy birthday !" | mail $USER

done