As this is a homework I will only give hints:
- Arguments passed to the script will be available as
$2(etc. for more arguments).
$#will be the number of arguments passed.
[ -d "dir" ]test will test whether
diris a directory.
find . -type f -size -50will find all regular files in the current directory (
.) with size less than 50 bytes.
A simple first start:
#!/bin/sh echo "There are $# arguments passed, the first two are '$1' and '$2'"
You should be able to read up on the rest by either reading relevant questions and answers on this site, or by using the
man command to read the manual of the shell you are using (e.g.
man bash). In
bash you may also use the command
help test to read about the
-d test and how to compare numbers.
find is documented in
man find and extensively referenced in questions on this site.
You should also consult whatever learning materials are associated with the class you are taking.
This question will likely be closed as a duplicate of your question from previous. If you have further questions, please make them specific and about particular issues you are facing while solving your problem.
A good question contains an explanation of the issue, the code that you are using, the way that you are executing your code, any actual error messages and/or warning messages that you see, along with what you expected the code would do. See also “How do I ask a good question?” and “What types of questions should I avoid asking? in the Help Center.
We are happy to help you, but we will not write your script for you.