Bash script Question


Results 1 to 6 of 6

Thread: Bash script Question

  1. #1
    Join Date
    Aug 2005
    Posts
    6

    Bash script Question

    Hi,
    I am learning Linux/Bash scripts. Can someone tell me if this answer is correct.?

    Thanks

    1.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

  2. #2
    Join Date
    Oct 2000
    Location
    Calgary, Alberta, Canada
    Posts
    8,116

  3. #3
    Join Date
    Aug 2005
    Posts
    6
    NO.

    I am practicing for the test from the Linux book questions.

  4. #4
    Join Date
    Jan 2004
    Posts
    407
    and how are we supposed to know without a copy of /etc/birthdays?
    DISCLAIMER: sometimes i use a text browser, so I may not see any emoticons directed at me.

    Brandon Niemczyk <bniemczyk@snprogramming.com>
    http://bniemczyk.is-a-geek.com

  5. #5
    Join Date
    Aug 2005
    Posts
    6
    hi, sorry
    that was wrong ques.


    1) Write a bash script, 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

  6. #6
    Join Date
    Aug 2001
    Location
    Somewhere, Texas
    Posts
    9,627
    best way to find out if it works is to run it

    looks fine to me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •