Question: Using Shell Script, Program a script that uses Gzip to compress such files (a) Write a script compress_large_files.sh. This script accepts one or more command

Using Shell Script, Program a script that uses Gzip to compress such files

Using Shell Script, Program a script that uses Gzip to compress such

(a) Write a script compress_large_files.sh. This script accepts one or more command line argu ments. The first argument has to be an integer; let's call it size. If this is the only command line argument, compress_large_files.sh inspects all files in the current working directory and compresses every file of size at least size If there is more than one command line argument, all arguments except the first one must be valid directories. In this case, compress_large_files.sh inspects the files in each of these directories and, once again, compresses every file of size at least size If successful, your script should not produce any output on stdout. You script should produce the following error messages If the wrong number of command line arguments is given, a usage message If the first argument is not a number, a message ERROR: xxx is not a number should be . If any argument other than the first one is not a valid directory, a message If a directory to be searched for files or a file in such a directory cannot be read, a message USAGE: compress_large files.sh size [dir ...] should be printed. printed, where xxx is the argument provided by the user. ERROR: xxx is not a directory should be printed, where xxx is the argument in question ERROR: Cannot read file xxx should be printed, where xxx is the file or directory in question. Subdirectories of the current working directory or of the directories provided on the command line should not be search recursively and should be ignored silently. (a) Write a script compress_large_files.sh. This script accepts one or more command line argu ments. The first argument has to be an integer; let's call it size. If this is the only command line argument, compress_large_files.sh inspects all files in the current working directory and compresses every file of size at least size If there is more than one command line argument, all arguments except the first one must be valid directories. In this case, compress_large_files.sh inspects the files in each of these directories and, once again, compresses every file of size at least size If successful, your script should not produce any output on stdout. You script should produce the following error messages If the wrong number of command line arguments is given, a usage message If the first argument is not a number, a message ERROR: xxx is not a number should be . If any argument other than the first one is not a valid directory, a message If a directory to be searched for files or a file in such a directory cannot be read, a message USAGE: compress_large files.sh size [dir ...] should be printed. printed, where xxx is the argument provided by the user. ERROR: xxx is not a directory should be printed, where xxx is the argument in question ERROR: Cannot read file xxx should be printed, where xxx is the file or directory in question. Subdirectories of the current working directory or of the directories provided on the command line should not be search recursively and should be ignored silently

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!