Find Jobs
Hire Freelancers

Bash scripts

$10-30 USD

Cancelled
Posted about 9 years ago

$10-30 USD

Paid on delivery
Write Bash scripts to do each of the following: 1) Write a script called ‘my_which’ that does the same thing as the Unix which command, but do it using a for loop over an if. Obviously, DO NOT call bash’s built-in `which` . 2) Write a script called dircheck that takes one or more directory names as argument and displays the following information about each directory argument: a. display a count of the number of subdirectories anywhere under this directory. b. display a count of the number of files in the directory. c. list all of the files in the directory that are zero length (you may use the ‘find’ command for this) d. use ‘du’ to display the amount of storage space used by this directory e. To test your script, you should create some subdirectories, some files that are zero length, using touch, and some files that are not zero length using vi, output redirection, or cp. f. Example of use $ dircheck ~/hw ~/bin 3) Write a bash script called `my_find` that does a subset of the find command. Obviously, DO NOT use `find` in your solution. You must handle (at least) the following options as described in the manual for find (and these will be tested for grading): -name (you should handle patterns for names), -type (f and d), -print, and -exec (you must handle {} for exec (hint: use sed), but you may assume the exec, if present, is always the last argument and, therefore, need not be terminated by a semicolon. Note also the predicates can come in any order and are implicitly short circuit ANDed together. You need not handle -o which is OR. Here is a sample command: $ my_find $HOME -name ‘*.o’ -type f -print -exec /bin/mv {} ~/.TRASH \;
Project ID: 7210101

About the project

Remote project
Active 9 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs

About the client

Flag of UNITED STATES
los angeles, United States
4.9
10
Payment method verified
Member since Nov 2, 2014

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.