Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Bash Shell Script to do the following: Get input from the user regarding student information and marks, then validate and display the results.

Write a Bash Shell Script to do the following:

Get input from the user regarding student information and marks, then validate and display the results. First prompt the user to get student information (first name, last name and student number). Ensure that correct number of parameters are entered and that data is valid (see validation rules below). If not, keep looping upto 3 times to get correct number of parameters containing valid data. If you still don't get valid data then stop the script.

Once you have the name and number for a student, prompt to get 3 course-codes with corresponding marks for each course. Again, loop upto 3 times till you obtain valid data, if not, then stop the script.

The script should check the marks to see in which course you got the highest marks, and display that result in a meaningful manner. If the highest mark was obtained in more than one courses, you need to display message showing all courses that have that highest mark.

Validation For each of the following, if blank or invalid data is entered, loop and prompt till valid input is received. After 3 tries, if data is still invalid, then stop script with appropriate message # of parameters entered Student name - Should have first name and last name, each of which should ensure first letter is uppercase and the rest is lowercase (to keep it simple, assume there is no middle names) Marks - numbers 0 to 100 only. Marks can be integers (eg. 90) or could have one decimal place (eg. 90.5) If user enters any leading zeros, then they should be stripped off (eg. 090.5 should become 90.5). Course code - 6 characters (first 3 uppercase alpha, next 3 numbers eg. ULI705) Student number - 6 digit positive integers only, including any leading zeros. Eg. 006574 is valid. Do not strip the leading zeros from the student number. All zeros should not be valid. Blank data, spaces or invalid data should not be allowed Script should not abort or crash at any point

Other requirements: All prompts to the user should be meaningful and give enough information to the user to enable them to provide required input Meaningful error messages should be given to user whenever error occurs All variable names should be meaningful and appropriate Appropriate exit status (0 or non-zero) should be set when exiting a condition Document your code throughout to describe what is happening Your code should use 'functions', be well organized and easy to follow Script should be located in ~/assign1 directory on zenit server and should be named marks.sh

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

1. How do most insects respire ?

Answered: 1 week ago

Question

Who is known as the father of the indian constitution?

Answered: 1 week ago