Question: Instructions: Your assignment is writing a shell script called drsh that deletes records from a simple text database. It accepts as arguments a database_name, a

Instructions: Your assignment is writing a shell script called drsh that deletes records from a simple text database. It accepts as arguments a database_name, a field name, and a field value. You should check if the database_name represents an existing database and if field name is one of the names of the fields defined in the schema for the specified database. If not, then you should print an appropriate error message and exit. Assuming there is correct input data, you should remove any records from the database where the value of that field matches the specified field _value and print a message indicating the number of records deleted from the database. instance, below is an example invocation of the dr.sh script. % dr.sh cop4342 exam2 73 There were 1 records deleted fram the cop4342 database Assume for this example that cop4342 is a valid database name (i.e. it is in the databases.txt file), it has a schema called grades (i.e. defined in the databases.txt file), grades has fields called name, examl, exam2, and exam3 (i.e. defined in the schemas.txt file), and that a file exists called cop4342.db and it contains the following data: Smith 84 72 93 Jones 85 73 94 Ford 92 64 93 Your shell script should indicate that 1 record has been deleted and the cop4342.db file should now contain the data: Smith 84 72 93 Ford 92 64 93 While you are allowed to invoke other shell scripts that you have written and predefined Unix utilities, you are not allowed to invoke other executables. If you need to store information into temporary files, then be sure to delete these temporary files before you exit your script. Instructions: Your assignment is writing a shell script called drsh that deletes records from a simple text database. It accepts as arguments a database_name, a field name, and a field value. You should check if the database_name represents an existing database and if field name is one of the names of the fields defined in the schema for the specified database. If not, then you should print an appropriate error message and exit. Assuming there is correct input data, you should remove any records from the database where the value of that field matches the specified field _value and print a message indicating the number of records deleted from the database. instance, below is an example invocation of the dr.sh script. % dr.sh cop4342 exam2 73 There were 1 records deleted fram the cop4342 database Assume for this example that cop4342 is a valid database name (i.e. it is in the databases.txt file), it has a schema called grades (i.e. defined in the databases.txt file), grades has fields called name, examl, exam2, and exam3 (i.e. defined in the schemas.txt file), and that a file exists called cop4342.db and it contains the following data: Smith 84 72 93 Jones 85 73 94 Ford 92 64 93 Your shell script should indicate that 1 record has been deleted and the cop4342.db file should now contain the data: Smith 84 72 93 Ford 92 64 93 While you are allowed to invoke other shell scripts that you have written and predefined Unix utilities, you are not allowed to invoke other executables. If you need to store information into temporary files, then be sure to delete these temporary files before you exit your script
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
