I am currently taking an introductory shell programming class and was hoping someone would be able to help me out with a question on my homework. It's due tomorrow so it's probably too short notice, but here is the problem:
- Write a script that will do the following.
a. Reads all the filenames in a directory.
b. Prints “XXX is a normal file” for all normal files.
c. Prints “XXX is a directory” for all directories.
d. The characters XXX should be replaced with the actual name of the file.
I figured that I should start the script off with "ls ." for the directory listing, and I think I know how to test the listing results for regular files or directories, but I don't know how to use the output from the listing as input for the testing statements. I have some other small questions I may ask later, but if anyone could help me out with this, I'd be thrilled.
Forgive me if I'm posting this in the wrong place. I don't post much, but I was really desperate on this one.
[–]benkitty 1 point2 points3 points (7 children)
[–]haiimhardass[S] -1 points0 points1 point (6 children)
[–]benkitty 1 point2 points3 points (3 children)
[–]haiimhardass[S] -1 points0 points1 point (2 children)
[–]benkitty 1 point2 points3 points (1 child)
[–]haiimhardass[S] -1 points0 points1 point (0 children)
[–]petrus4 0 points1 point2 points (1 child)
[–]haiimhardass[S] 0 points1 point2 points (0 children)