#!/bin/bash # OPS435 - lab00 # Written by John Selmys - May 2008 # Modified by Murray Saul - June 2008 # Seneca College, Toronto # # BASH script to compute the day of the week on which someone was born # clear read -p "Greetings, I'm Linux. What's your name? " name echo echo Hi $name. read -p "Do you want me to compute the day of the week you were born on? (yes|no) " answer answer=$(echo $answer | tr 'a-z' 'A-Z') if [ "$answer" = YES ] then echo echo "Great! But first I'll need some information." read -p "Please tell me the year in which you were born: " year echo read -p "Now tell me the number of the month in which you were born: " month echo read -p "Finally, I need to know the day of the month in which you were born: " day echo echo "Thanks. Now I'll compute the day of the week that you" echo "were born on, but it may take some time so please be patient." echo -n "calculating " sleep 1 echo -n "." sleep 1 echo -n "." sleep 1 echo -n "." fulldate=$year-$month-$day weekday=$(date -d $fulldate +%A) echo echo "OK, I got it. You were born on a $weekday" echo sleep 2 echo "Now, if you don't believe me, ask someone that witnessed it..." echo echo See you later. else echo Goodbye. fi