Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

(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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions

Question

Compare levels of resolution in conflict outcomes?

Answered: 1 week ago

Question

Strategies for Managing Conflict Conflict Outcomes?

Answered: 1 week ago