Question

a) Implement the following using shell script. [5 Marks] Implement a database of student names and their marks Store the name

Note: using by Bash Script

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Check out the solution and let me know if you have any queries through COMMENTS.

___________

#!/bin/bash

# read the number the student from user

echo "Enter the number of Students : "

read n

# initialize the required variable

i=1

# loop till n

while [ $i -le $n ]

do

echo "Student #"$i

# get the names and marks from user and save them in arrays

echo "Input Student name: "

read names[i]

echo "Input Marks of the Student: "

read marks[i]

# increment the variable

i=$[i+1]

done

# while ends

# newline

echo

# display as required

echo -e "Names" ' \t ' "Marks"

# loop through the arrays and display the array contents

i=1

while [ $i -le $n ]

do

echo -e ${names[i]} ' \t ' ${marks[i]}

i=$[i+1]

done

_________

#!/bin/ bash 3 # read the number the student from user 4 echo Enter the number of Students : 5 read n 7 initialize the requi

______

Result... executed in 22.583 sec(s) Enter the number of Students: Student #1 Input Student name: stud1 Input Marks of the Stu

Add a comment
Know the answer?
Add Answer to:
A) Implement the following using shell script. [5 Marks] Implement a database of student names an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please write a bash script for the following two questions, thank you.    Write a shell script...

    Please write a bash script for the following two questions, thank you.    Write a shell script “6-1.sh” to calculate the exponentiation using while loop. This script needs to take two inputs like “6-1.sh a b”, and outputs the result of “ab”. Note: You need to implement it, DO NOT use the exponentiation operation provided by the Linux.    Write a shell script “6-2.sh” to calculate the factorial of a number using while loop. This script needs to take one input...

  • Please provide a makefile that installs bash and runs a shell script using bash.

    Please provide a makefile that installs bash and runs a shell script using bash.

  •        Write a shell script “6-1.sh” to calculate the exponentiation using while loop. This script needs...

           Write a shell script “6-1.sh” to calculate the exponentiation using while loop. This script needs to take two inputs like “6-1.sh a b”, and outputs the result of “ab”. Note: You need to implement it, DO NOT use the exponentiation operation provided by the Linux.        Write a shell script “6-2.sh” to calculate the factorial of a number using while loop. This script needs to take one input like “6-2.sh a”, and outputs the result of “a!”.

  • Programs/scripts 13. Write a bash shell script that displays the date by using the shell command...

    Programs/scripts 13. Write a bash shell script that displays the date by using the shell command date. 14. Write a command line program that takes a number and a command as arguments. Call that command that number of times. For example, if your program name is "test" test 3 dir <shows directory> dir <shows directory> dir <shows directory>

  • Write a script using the bash shell to add new users to the system. The script...

    Write a script using the bash shell to add new users to the system. The script should read user information from a comma-delimited file (each field should be separated by a comma). The filename should be passed to the script as a command-line argument. Be sure the script contains a usage clause. The input file should contain the user information with one user per line. As the system administrator, you should determine the information necessary for each user to properly...

  • SHELL SCRIPT: Provide the following questions with the codes and command line Problem 5: Take 5...

    SHELL SCRIPT: Provide the following questions with the codes and command line Problem 5: Take 5 input arguments in a for loop, but only add the even i values to sum and display the result. Problem 6: Write a shell script that accepts path of the directory and returns a count of all the files within the specified directory. (Hint: use alias to perform cd operation) Problem 7: Write a shell script that takes an ‘count’ value as an input...

  • An objective of this task is to implement SQL script that verifies the following logical consistency constraint imposed...

    An objective of this task is to implement SQL script that verifies the following logical consistency constraint imposed on the contents of a sample database. "All orders submitted after 30 April 2019 must not include discontinued products" Download a file solution1.sql and insert into the file the implementations of the following actions. (1) First, the script inserts into a sample database information about a new order submitted today that includes two products. One of the products is discontinued while the...

  • Hello, I am attempting to write a basic shell script using bash. It will need to...

    Hello, I am attempting to write a basic shell script using bash. It will need to print the user, host, time, and date. It will need to take user input for a txt file to be searched and create a new file to save the results. It must print the number of lines and characters in the text. The user will need to enter three words to be searched, and the number of occurrences of those words in the text...

  • ONLY REQUIRE C Problem statement: You are to write a program that manages student marks for...

    ONLY REQUIRE C Problem statement: You are to write a program that manages student marks for a class. Student marks are stored as a 2D array. Each row represents the marks of one student. Each column represents one assessment. For example, if we have two students and 3 assessment items with the marks for student1 being (67.6,88.5, 75.4} and student2 being (77.5, 76.2,78.3} our 2D array would look like: 67.6, 38.5,75.4 77.5, 76.2,78.3 You are to write a script/main function...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT