Unix Shell script

posted by .

Shell script

Using "if" statement checks for a file called "student.txt" in the current directory. Removes (deletes) the file if it exist. This file will collect last name, first name, and grade for 5 people.

Use a while loop to get the information (last name, first name, and age) for 5 people. grade should be 0-100. Use three different variable names (fname, lname, and grade) to read the data from the keyboard.

Store the data read from the keyboard in a file called "student.txt". After reading all the data for 5 people, display contents of name.txt file on the monitor.

Below is my attempt

if [ -f name.txt ]; then
# I put something in here and it'll be done if the file exists
fi

person_num=1
while [ $person_num -lt 6 ]; do
# put something here to repeat for each person

-p fname
-s name.txt
-p lname
-s name.txt
-p age
-s name.txt
person_num = $(eval $person_num + 1)
done


if[$person_num ==6]
# read name.txt file
-r name.txt

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. operating system

    I been working on this forever can you please show fully how to create these 2 small scripts. It would be very appreciated! the editor im using is VI 1. Write a script called simple.sh to do the following: Displays "There are no arguments" …
  2. Unix Script

    "Using "if" statement checks for a file called "student.txt" in the current directory. Removes (deletes) the file if it exist. This file will collect last name, first name, and grade for 5 people. Use a while loop to get the information …
  3. C++

    File version maintenance utility   A team of software developers has been asked to develop a file version maintenance utility . The utility should maintain all the  version of a file. When a user modifies a file, the current version …
  4. bookkeeping

    Using your computer, you create a file for an existing costumer. When you're finished, you should a. overwrite the existing file by giving the new file the same name. b. use Save as to save the new file under a different name c. coordinate …
  5. programming

    b. Write a well-commented C++ program that reads data from the input file employee.txt. Each input line consists of last name, first name, base salary, total sales, and number of years of service. Store the output in the file employees_payCheck.txt. …
  6. offfice finaces

    Using your computer software, you create a new file for an existing customer. When you're finished, you should A. coordinate the old and new files by giving both the same name. B. overwrite the existing file by giving the new file …
  7. Ed. Tech

    When you save documents, it is important to check the blank at the top of the navigation window to ensure you are saving your file in the correct location. A. address bar B. insert ribbon C. file type D. file name Is the answer D?
  8. Literature

    When you save documents, it is important to check the _____ at the top of the navigation window to ensure saving your file in the current location A.adress bar ** B.insert ribbon C.file type D.file name
  9. linux networking

    What are two ways you can execute a shell script when you do not have execute permission for the file containing the script?
  10. Microsoft word

    Suppose you want to delete an existing file from within Word. What would you do?

More Similar Questions