Genral scripting help...

here is a link to the assignment that i need to do...

http://spot.pcc.edu/~wmorales/cs140u/hw8.htm

this is what i have done so far...

#!/bin/sh

gmailer1 ()
        {
		echo -e "Who would you like to Send an e-mail to: \c"
		read Adress
		echo -e "What is the Subject of your e-mail \c"
		read Subject
		echo -e "Would you like to add an attachment (n=0 or y-1): \c"
		read attach
		if [ $attach -eq 1 ]
			echo -e "add what you want \c"
		fi

		return
        }

users_currently_logged_in1 ()
        {
		users
        }

current_date_and_time1 ()
        {
		echo		

		echo "Weird date"
		
		ddate

		echo

		echo "Normal date"

		echo
        }

this_months_calander1 ()
        {
		cal
        }

name_of_working_dir1 ()
        {
		pwd
        }

contents_of_working_dir1()
        {
		echo -n "What is the name of the dir that you would like see the files of ?:"

		read contents

		ls "$contents"/* | more
        }

find_ip_of_web_address1 ()
        {
		echo -n "please type in the website you wish to see the ip of. Use full web adress please."

		'ping -c 1'	
        }
see_your_fortune1 ()
        {
		fortune
        }
print_the_screen1 ()
        {
		echo -n "What is the name of the text file you would like to print to the screen?"

		read ptsc

		cat "$ptsc" | more
        }
exit1 ()
        {
		break
        }
invalid_option1 ()
	{
		echo "invalid option, try running the app again!"


echo "use one the following options:"
echo "  a:      Emailer"
echo "  b:      Users currently logged in"
echo "  c:      Current date and time"
echo "  d:      This months calander"
echo "  e:      Name of the working directory"
echo "  f:      Contents of working directory"
echo "  g:      Find the IP of a web address"
echo "  h:      See your fortune"
echo "  i:      Print file on the screen"
echo "  j:      Exit"
echo -n "Enter your option and hit <Enter>:"
read option
case "$option" in
        a|A) gmailer1

                ;;
        b|B) users_currently_logged_in1

                ;;
        c|C) current_date_and_time1

                ;;
        d|D) this_months_calander1

                ;;
        e|E) name_of_working_dir1

                ;;
        f|F) contents_of_working_dir1

                ;;
        g|G) find_ip_of_web_address1

                ;;
        h|H) see_your_fortune1

                ;;
        i|I) print_the_screen1

                ;;
        j|J) exit1

                ;;
	*) invalid_option1

		;;
esac

i still need to tweak alot of this to do what my teacher wants it to do...

the main thing is in the mailer. I should make it so that you cannot attach anything to an email except a text file...

also, to exit the script you press "j" witch is set in a function to close the script. I need to figure out how to put the whole script in some kind of a loop so when i type in "j" it exits, but if i enter anything else as an option it keeps the script running...

And i cant find away to keep the script running after it goes through an option. I tested out the mailer, but when its done it goes back to the prompt. I need it to go back to the beginning of the script where it asks for what you want to do...

Thanks for your help!!

Read forum rules #6. No homework problems allowed.

Thread locked due to forum policy.