|
Okay, here's what I hope is an easy one. I am brand new to the world of BSD and have been using some downloaded teaching material to learn my away around. I should note that I am learning on OSX Tiger (I know this isn't an ideal situation to begin my understanding of BSD but it is my only available option at this time). I'm using tcsh in case that's relevant. Today I ran into a problem while attempting to perform an exercise in one of my books: "Create a command that will list the contents of each subdirectory of the /home directory beginning with the letter k, count the number of files found, and save that number in a file called k-users-files." The answer to this problem, as given by the book, is: code:
Is this just an OSX Tiger quirk or did the authors of this book screw up, and what is the "real" answer to this problem?
|
# ¿ Jul 13, 2008 05:11 |
|
|
# ¿ Apr 26, 2024 18:41 |
|
Thanks for your input. Now that you've put it that way, I guess my problem is also one of grammar. It is difficult to tell by the way the question is worded if I am supposed to count files only in subdirectories that begin with the letter k or if I am supposed to count files that begin with the letter k in all subdirectories. In the latter case then your code will indeed produce the correct answer - you could even add the -l argument to the wc command to get nothing but the correct answer. Your interpretation of the question is probably correct, insofar as it seems a more likely real-world scenario. With that solved, though, can anyone produce a command to solve the former interpretation of the question? That is, how would one go about listing all files in subdirectories that begin with the letter k?
|
# ¿ Jul 13, 2008 06:19 |