Unix script

profilehomework.unix
Project1-MCIS5013.pdf.pdf

MCIS 5013(030) – Unix Operating System Summer I, 2018

Page 1 of 4

Project 1- korn shell script (200 Marks)

No Name, ID and section name: 2 point deduction

No output is provided: 10 point deduction,

Late Policy: 1 day per 10% deduction

Don’t copy other students’ work

Expected Output

<< MCIS 5013 – Unix Operating System >> date: wed June 13, 2018

Name Prog Labs Midterm Final Total Avg Grade

===========================================================================

Akers John 90 88 80 70 328 82.00 B

Eckert Hester 80 90 67 89 326 81.50 B

Spence Frances 70 81 78 85 314 78.50 C

Shaw Mary 88 79 90 78 355 83.75 B

Gates Willam 67 66 80 90 303 75.75 C

Thompson Ken 80 60 90 89 319 79.75 C

==========================================================================

Reported by: Jongyk

Direction

1. Write two Korn shell scripts( ksh ), Grade_main.sh and Grade_sub.sh

Each script need to start with a line #! /bin/ksh

2. Grade_main.sh

a. put your name, section name and simple description for the assignment

b. Print Title and date at the same line use printf command and cut command

<< mcis 5013 Grade Report >> Date: Wed June 13, 2018

eg.

Wed June 13 17:48:15 CDT 2018 take --> Wed June 13, 2018

The purpose of this project is to write a simple korn shell script.

MCIS 5013(030) – Unix Operating System Summer I, 2018

Page 2 of 4

c. Grade_main.sh file should have contain more than five student names

(First name and Last Name) and their scores( prog, Labs, midterm and final)

# you can use your data

Grade_sub.sh Akers John 90 88 80 70

Grade_sub.sh Eckert Hester 80 90 67 89

Grade_sub.sh Spence Frances 70 81 78 85

Grade_sub.sh Shaw Mary 88 79 90 78

Grade_sub.sh Gates Willam 67 66 80 90

Grade_sub.sh Thompson Ken 80 60 90 89

d. Last line you need to print your account using command ‘whoami’

( who am i will work with no space between word  whoami)

3. Grade_sub.sh

a. put your name, section name and simple description for the assignment

b. This script will calculate the total score and average, based on the average score

you need to determine Grade and print it.

( Average should use formatted output %.2f )

c. Declare variables

d. Summation of all scores and save it to the total variable that you declared

e. Calculate Avg

f. depending on Avg, printf Grade

(use if-then-elif-else-fi)

Grade will be assigned as follows:

Average 90 ~ 100 -- A

Average 89~ 80 -- B

Average 79~ 70 -- C

Average 69~ 60 -- D

Average 59~ 0 -- F

MCIS 5013(030) – Unix Operating System Summer I, 2018

Page 3 of 4

4. Program Examples

vi Grade_main.sh

#! /bin/ksh

#Author : Howard Kim

#Section : 401

#Description : put your description

printf “<< mcis 5013 Grade Report >> Date : ”

printf `date ` “\n”

print “Name Prog Labs Midterm Final Total Avg Grade”

Grade_sub.sh Akers John 90 88 80 70

Grade_sub.sh Eckert Hester 80 90 67 89

Grade_sub.sh Spence Frances 70 81 78 85

Grade_sub.sh Shaw Mary 88 79 90 78

Grade_sub.sh Gates William 67 66 80 90

Grade_sub.sh Thompson Ken 80 60 90 89

print “ Reported by :”

:wq!

vi Grade_sub.sh

#! /bin/ksh

#Author : Howard Kim

#Description : put your description

#Declare user defined Variables

Fname=$1

Lname=$2

prog = $3

lab =$4

..

..

..

MCIS 5013(030) – Unix Operating System Summer I, 2018

Page 4 of 4

Sum = prog + .. + .. + …

Avg = Sum /4.0

printf "%s %s ...." Fname Lname ..... sum avg

if (( ))

then

printf "%s" A

elif (( ))

then

printf "%s" B

elif(( ))

...

else

...

fi

:wq!

5. Submission (Three files)

Upload

a. your two script files on the black board Grade_main.sh & Grade_sub.sh

b. your output result document containing screen shot (Grade.docx)