Need a Lynx in shell scripting -- 2

Job ID: 35196632

Budget: ₹1,500 – ₹12,500 INR

Build a system administration tool that provides functionality for file backup and restoration. You will need to determine characteristics of files, perform operations on files (in this case, compression), and be able to add and extract files from an archive file (in tar format).
you will provide for all functionality of the script by evaluating the command line (its options, a.k.a. flags, possibly with arguments; and positional parameters) and environment variables. This might make the script more appropriate for use via cron or remote execution.
The name of the archive file will be passed to the script on the command line. Additionally, the following flags and actions will be supported:
-b : backup a copy of filename from the filesystem into the archive, but only if it is not already in the archive or if it is newer than the version in the archive. If filename does not exist in the filesystem, silently exit with error code 7.
-r : restore filename to the filesystem from the archive if it is in the archive; however if a version of the file exists in the filesystem and that existing file is older than the version from the archive, then restore the file from the archive to the filesystem as filename.newer, otherwise rename the existing file filename.older and extract the file from the archive to the given filename
-c : gzip compress the file before adding to the archive; you will calculate the percentage saved and write the current system date and time, filename, and the saved amount (as a percentage) to the logfile with the name of the value of the environment variable A2LOG (if set) or assign2.log (if A2LOG is not set)
If an invalid flag (an option not b, r, nor c) is passed to the program, exit silently with a return status code of 3. In support of the -b flag: submissions by undergraduates will only need to support an actual file name, graduate students’ scripts will support filesystem wildcards and handle one or more matches.
provide the additional following functionality. If the archive file to restore from does not exist, do not print any error message, just exit with return status code 7. The script must ensure that appropriate permissions to files and directories exist: if a file to be archived is not readable, exit with status code 19.