Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this, I attach the pages 456. Please test it before posting the answer because I had multiple errors with the other

I need help with this, I attach the pages 456. Please test it before posting the answer because I had multiple errors with the other answers. image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Assignment 6 The next two assignments will be similar. Assignment 6 will assume that your program's input is perfect. Assignment 7 will not, thus giving you a chance to test out mechanisms which handle imperfect input. Control structures, loops, and sequential operations are required elements for programming languages. A high- level programming language will implement control structures, loops, and sequential operations in a machine- independent manner. These mechanisms allow programs to branch out to different parts depending on a logical decisions. Remember that binary operations like shell commands output return values of true or false. Instructions One common feature of high-level programming languages is the ability to create a menu system. In this assignment you will develop a menu-based shell script which will run UNIX commands. Please look at the command menu program on page 456 (or page 444 in the third edition of the textbook). Your job will be to implement similar program with a total of 10 commands, plus the catch all case. This program will have a menu with 10 commands from the menu below . wmorales@syccuxfs01:> bash menu_script.sh Command Menu a. Emailer Program b. Display Users Currently Logged On c. Display Current Date and Time d. Display This months Calendar e. Display name of the Working Directory f. Display Contents of the Working Directory g. Find the IP of a Web Address h. See your Fortune i. Display a file on the screen j. Exit Please select a letter Here is a sample interaction with the emailer portion of the program. There is no need to . display the calendar or show a list of available files to attach. Please select a letter: a (this would go to the option for the emailer program that you created) This program will allow you to send a message, with a file attachment, to any selected user Please enter the subject of your message and press : Test message Please enter the email address of the recipient and hit :wmorales@pcc.edu Please enter the file to be attached to this message and press please choose a file: testfile Then it would got back to the main menu r program. A comment block such as those on the examples seen in the lecture must be on top of your script file with your name, date, description of the program. Make sure to document your program with comments in the various areas of your program. Ask questions if you are in doubt about what need to be accomplished and use the discussion board. After testing your menu program and verifying that it worked correctly, put your program inside of a loop (e.g., using until or while). Consequently after each option is concluded your program will go back to the main menu until the user selects an option to exit. For full points use a structured logic approach to exit the program. Try NOT TO USE THE EXIT command to quit the script. Also, using infinite loop such as while: or while true or until true, etc. is NOT good programming. Your first option will be an emailer program, and the user needs to input the subject, recipient name, and file which represents the body of the e-mail which you'll redirect as input. This emailer program will be automated using mail: mail -s".. The whole program should be in one file; do not call different scripts (-/emailer.sh for instance) Some items to check where points may be deducted, the same will apply for #7 with additional items to be checked as required in the assignment instructions. 1) Lack of comments on your program 2) Use of meaningful variable names 3) #/bin/bash should be the first line of our program. 4) Using the option read-n1 varname allows you to tap on "one key to continue 5) Many commands might produce a full screen of output and you will not be able to see the what was on the top, so always use "1 less" 6) Use the command clear to clear the screen and have a non-cluttered output. 7) Use the logic of the loop to get out of the loop, using exit 1 or exit O still terminates the program but you are forcing the end of the program instead of using the logic of a loop 8) There are many ways to implement the until loop, but you need to make sure to use the proper operator and initialize the input variable before it is checked in the until loop. Otherwise the comparison condition may always be true or false. Use the logic of the loop to end the program. 9) Consider using functions. They will be easier to troubleshoot if your program does not work and it organizes your program 10) Initialize your variables to a value before using. 11) Test you emailer. 12) Logical expressions are the result of unary or binary operators. For instance if a>b then... you do not use ifabc, you need to break it down into if a> b&& a>c file reference o,, . c. Name of the working directory" echo -e read -p "Enter a, b, c, or d: " echo CONTROL STRUCTURES 457 d. Contents of the working directory n answer case "Sanswer" in a) date b) who ts are tried, etween two c) pwd case d) echo There is no selection: Sanswer" esac /command menu COMMAND MENU a. Current date and time b. Users currently logged in c. Name of the working directory d. Contents of the working directory Enter a, b, c, or d: a Sat Jan 6 12:31:12 PST 2018 hto interpret In as a NEWLINE character. If you do not include re the menu easy to

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Describe the factors influencing of performance appraisal.

Answered: 1 week ago