Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Requirements You must write a Perl program that will provide a listing of files in a directory. The files must be listed in sorted order

Requirements

You must write a Perl program that will provide a listing of files in a directory. The files must be listed in sorted order by the filename.

By default, the program displays only filenames.

By default, the program lists the files in the currentdirectory.

The program must provide the following command line options to theuser:

-d [directory]: This option allows the user to specify a directory or no directory name. If the -d option is provided without specifying a directory name, list your current directory (~student user name/itec400/homework). The output shall be displayed using the following columnheaders:

File Name Size Owner Group

-l: This option instructs the program to display a long listing. The output shall display the following columnheaders:

File Name Size Owner Group

The user selects no options. List the file names under your current directory (~student user name/itec400/homework). The output shall display the following columnheader:

File Name

The script must be able to execute oncs.franklin.edu

The script file name must be:listdir.pl

The script must be located in$HOME/itec400/homework

Make sure the permissions on the your itec400 directory are 705

Make sure the permissions on your script are705

Sample Output

User selects no options (provide column header and list filenames):

> listdir.pl

File Name

4th

4th_log

4th.old

4th.old.2

address.cpp

address.h

address.o

User selects -l option (only subset of output isshow):

> listdir.pl -l

File Name Size Owner Group

OUTPUT HERE

User selects -d option.

> listdir.pl d

File Name Size Owner Group

OUTPUT HERE

User selects -d option without specifying a directoryname.

> listdir.pl d

File Name Size Owner Group

OUTPUT HERE

User selects -l and -d option (./listdir.pl l d )

> listdir.pl -l -d

/export/home/dandrear/temp OUTPUT HERE

User selects -d and -l option (illegalcombination):

> listdir.pl -d l

Standard output:

Usage: listdir.pl [-d directoryname][-l]

listdir.pl [-l] [-d directory name]

listdir.pl [-ddirectory]listdir.pl [-d]

listdir.pl [-l]NOTE: All other options are invalid for usage.

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

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

=+(2,5], P1) such that Fc F, and P, agrees with P on $ .

Answered: 1 week ago