Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone please help me with this Linux/Unix question? I've had to ask this question twice now Write a script named long_file.sh to find the

Can someone please help me with this Linux/Unix question? I've had to ask this question twice now

 Write a script named long_file.sh to find the longest file name in a directory. long_file.sh will accept a directory name as the first argument and determine the longest filename in that directory. If the correct number of arguments are not provided, print an error message to standard output and exit the script with a return error of 1. If the scripts's first argument is not a directory name, print an error message to standard output and exit with a return code of 1. If a the first argument is a directory, print the directory name prior to printing the longest filename and length. If there are multiple files with the same length, you may print the first one found. You may print multiple filenames for 5 bonus points. (See GRADUATE student requirements below). Example run: $ ./long_file.sh /home/michelle/temp Directory: /home/michelle/temp Longest filename: longerfilenameishere Longest filename len: 20 Directory listing from test directory $ ls /home/michelle/temp file1 file2 file3 file4 longerfilenameishere Example run 2: $ ./long_file.sh Usage: ./long_file.sh directory Example run 3: $ ./long_file.sh file1 First parameter must be a directory (file) Rubric: 50 points Correct script name: 5 Check for valid parameters: 5 points Check for directory: 5 points Print out correct filename: 5 points Print out correct length: 10 points (Documentation) Reasonable comments in code 10 (Coding standards) Accepted programming standarrd and conventions 10 

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

Students also viewed these Databases questions

Question

1. Speak plainly and briefly, and avoid jargon.

Answered: 1 week ago

Question

gfig-v z

Answered: 1 week ago