Lab 1 Ex1 : Scripting Web Server

Lab 1 Ex1 : Scripting Web Server

You cannot submit for this problem because the homework's deadline is due.

Ex1: Scripting Web Server

Related Topics: Linux.

Jin decides to develop his personal website and implement a convenient shell script to automate command line tasks. These tasks include:

  • Create: create the working directory of the database and webserver, and initialize the database;
  • Dump: dump the data in the database into the webserver;
  • List: list all the files stored in the webserver;
  • Display: display the data in the webserver;
  • Destroy: remove the working directory of database and webserver.

He has already implemented the skeleton of ex1.sh, but he forgets to add some basic commands. There are 5 of such lines in the script that are marked as TODO comments:

# TODO: Replace this line with a linux command line.

Please help him finish this script by replacing the TODOs with a Linux command line you learned from lecture.

  1. Create a directory named sql/.

  2. Copy the file sql/database.txt to the directory webserver/

  3. List all files in directory webserver/.

  4. Display webserver/database.txt in stdout.

  5. Remove the webserver/ and sql/ directories.

Testing

To test the script, please first make it executable by running:

chmod +x ./ex1.sh

Then, you can test the script by running the following commands and observe the results.

./ex1.sh create
./ex1.sh dump
./ex1.sh list
./ex1.sh display
./ex1.sh destroy

Lab One: Linux and Review of C++

Not Claimed
Status
Finished
Problems
3
Open Since
2022-05-18 00:00
DDL
2022-05-24 23:59
Extension
72.0 hour(s)