Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 20
Script that -asks for a name, phone number, and date of birth and appends these details to a comma separated value file called birthday.csv -sorts birthday.csv by birthday (not by ...
  1. #1
    Just Joined!
    Join Date
    Feb 2010
    Location
    England
    Posts
    11

    Question Bash Script: Need help with this !

    Script that

    -asks for a name, phone number, and date of birth and appends these details to a comma separated value file called birthday.csv

    -sorts birthday.csv by birthday (not by age ) to produce a new file newbirthday.csv. The format of each row is:
    <name>,<phoneNumber>,<YYYY/MM/DD>.

    Script " bdayalarm.sh " that :
    -if today it's someone’s birthday, display “Birthday Alarm” followed by rows of the name of each person whose birthday is today and their phone number, otherwise show the next birthday in the year.



    If anybody could help me with that i would appreciate it...
    i just got stuck and i know it's an easy script but i'm a newbye in this

    Cheers!

  2. #2
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    616
    sounds like homework. i'll give you a hint:

    Code:
    FILE=birthday.csv
    echo -n "Name: "
    read -e NAME
    ...
    Then you'll need some way of putting those variables into a script, (i'd suggest using echo). That's all the help I can give ya, figure out more, if you get stumped come on back.

    What exactly are you stuck on?

  3. #3
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    You should start with something at least. Even if we lay out what you need, it won't necessarily be helpful to you.

    Admins of this forum will point out to you that homeworks are not allowed here, as per the forum rules.
    0 + 1 = 1 != 2 <> 3 != 4 ...
    Until the camel can pass though the eye of the needle.

  4. #4
    Just Joined!
    Join Date
    Feb 2010
    Location
    England
    Posts
    11
    well i've done the

    echo " enter your name phone etc. " part

    i've named the variables ...
    done the
    read name
    read phone etc

    and when i want to put these variables into the the file .csv
    it won't work using the script
    cat and > or >> and ^d ... it just won't put them in the file birthday.csv
    as for the ordering part i don't have an idea yet...

    Quote Originally Posted by nmset View Post
    You should start with something at least. Even if we lay out what you need, it won't necessarily be helpful to you.

    Admins of this forum will point out to you that homeworks are not allowed here, as per the forum rules.
    who said anything about homework ?
    i'm 21 years old and i'm doing this linux course...i'm just trying to get used to the whole thing so i started up on some basic exercises .

    P.S. i'm using pico editor via sage

    right,i'm off for a jog ,hope i get some good hints/help.
    talk to you in a bit .

  5. #5
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    616
    don't use cat. use something like:

    Code:
    echo "$NAME,$PHONE,$DOB" >> $file
    cat is more for like putting the files into STDOUT

    A lot of people come here for "help" with scripting classes. And by help I mean they essentially want someone else to write it for them, so don't take it too personal

  6. #6
    Just Joined!
    Join Date
    Feb 2010
    Location
    England
    Posts
    11
    Quote Originally Posted by scathefire View Post
    don't use cat. use something like:

    Code:
    echo "$NAME,$PHONE,$DOB" >> $file
    cat is more for like putting the files into STDOUT
    tried that still comes with a freaking error for some reason :/

  7. #7
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    616
    what be the error?

  8. #8
    Just Joined!
    Join Date
    Feb 2010
    Location
    England
    Posts
    11
    Quote Originally Posted by scathefire View Post
    what be the error?
    erm apparently i can't post pics ... since i don't have 15 posts...
    guess it's an anti-spam solution ...
    i'll get back with details after my run

    later edit:
    ok back .
    it shows me :

    ./bdayadd.sh : line 15 : vicktor (this is the $name) :command not found

  9. #9
    Just Joined!
    Join Date
    Feb 2010
    Location
    England
    Posts
    11
    bump ! .

  10. #10
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    616
    you probably wrote your script wrong, try making each input like this:

    Code:
    echo -n "What the screen will read"
    read -e VARIABLENAME

Page 1 of 2 1 2 LastLast

Posting Permissions

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