(CIS155 -Unix OS) Assignment2 -MenuProgram

(CIS155 -Unix OS) Assignment2 -MenuProgram - 1 # 'Backup...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
# 'Backup and Go' script written 3/18/09 by Shanna Hawxhurst. 2 # Menu-style program can either display the date/time, calendar, or a list of files, or it can backup files to a 'Backup' directory. 3 # 4 tput clear # Clears screen for menu 5 repeat=y # Initialize loop variable 6 while [ "$repeat" = y ] # Start main loop 7 do 8 echo -e "\n\n\n\tShanna's Backup and Go\n\n\n" # Formatted menu title 9 echo -e "Please choose one of the following menu options :\n\n\n" 10 echo -e "1. Display Date and Time\n" 11 echo -e "2. Display Current Calendar\n" 12 echo -e "3. Display a List of My Current Files\n" 13 echo -e "4. Save Files in my Home Directory to a Backup Directory\n" 14 echo -e "5. Quit and Exit Program\n\n" 15 echo -e "\tEnter Selection: \c" # Prompts for user's choice 16 read choice # Reads user's selection 17 tput clear 18 case $choice in # Begins case construct 19 1) echo -e "\n\n\tHello!\n\nThe current date and time is:\n\n\n" 20 date +%A","" "%B" "%e" "%Y" "%l:%M" "%p # Displays current date/time 21 echo -e "\n\n\n\n\nEnter \"c\" to return to the menu, or \"x\" to exit the program. \c" # Quit/Continue? 22 read end # Reads user's choice to quit/continue 23 while [ "$end" != c -a "$end" != C -a "$end" != x -a "$end" != X ] # Loops if wrong input 24 do 25 echo -e "\nOops! Please enter either \"c\" or \"x\". \c" 26 read end 27 done 28 if [ "$end" = x -o "$end" = X ] 29 then 30 repeat=n # Sets variable to end program and exit 31 fi ;; 32 2) echo -e "\n\n\tHello!\n\nCurrent month's calendar:\n\n\n" 33 cal # Displays current calendar 34 echo -e "\n\n\n\n\nEnter \"c\" to return to the menu, or \"x\" to exit the program. \c"
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/19/2012 for the course COMPUTER S 100 taught by Professor Brown during the Spring '11 term at Strayer.

Page1 / 4

(CIS155 -Unix OS) Assignment2 -MenuProgram - 1 # 'Backup...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online