Loop Assignment
- (5 pts)
Write script named forLoopOne that uses a for loop to
process an unknown number of arguments (i.e., you need to use shift)
and ouputs only the names of those that are directories. No extra
output is to be given.
If the user issues:
- forLoopOne a1 a2 a3 a4 a5 d1 d2 f1 f2 f3 f4 f5 d1
The output is:
- d1
- d2
- d1
- (10 pts)
Write a script named forLoopTwo
that takes two parameters that are line numbers for the
dictionary, and produces the words on those lines separated by a
space.
You MUST use a for loop
Remember that you have to add one to last-first. E.g.,
-
length=`expr $2 - $1 + 1`
Keep in mind that you can use variables as values for head and tail.
E.g.,
head -$2 $words | tail -$length
To hand these in:
- Move both scripts to your obsidian dropbox
- On D2L go to the forloop drop box and submit a message that you have placed
them on obsidian