Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
(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 silentlyStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started