There was a question that I have been asked, I won't lie it is from homework, regrading the ls, list, command and I am hopelessly lost and just can't seem to figure it out. Here is question:
Summarized Question
There is something about the naming of the files in a directory that cause ls, including ls . and ls -a, not to work when in the directory, however if you do an ls of the directory from somewhere else the files show up.
Example, the current directory is /usr/local/etc/fred/
If I ls, ls ., ls -a nothing shows up
However if I cd to, say for example, /usr/local/ (Or any other directory for that matter
and do an ls /usr/local/etc/fred/ the files are listed.
Full Question
Quote:
One day, as you’re pondering an assignment for CS49C, your housemate notices the following remarkable thing and asks you about it: there’s a directory whose files he can list with the ls command, but only from outside the directory. You investigate, and you discover that the ls command – when run without arguments – seems to work fine when the default directory is anything other than the directory your housemate pointed out (which happens to be /usr/local/etc/fred). But your housemate is correct: executing ls when the default directory is /usr/local/etc/fred just gives you back the command prompt. You’re almost ready to believe the directory is simply empty, but your housemate insists this isn’t some lame joke.
For completeness, you try ls –a, but that seems to have no effect. In fact, even the default . and .. files are not visible. Finally, you do what your housemate has been asking you to do all along, and you cd to a different directory and then do an ls of /usr/local/etc/fred. To your amazement, you discover there are files in the directory. It is indeed as though the files had been made truly invisible, but only from within that single directory. And when you look over the names of the files more closely, you suddenly understand what your housemate has done to produce this bizarre behavior. What has happened?
Hint: it’s not a permissions issue, and it’s classic Unix.
As was stated at the end of the original question, it is not a permissions issue, so that rules that out. Also the fact that ls -a didn't work even while in the directory rules out that the files are hidden by starting with a dot. I feel as if it has something to do with the way files are named, but can't figure out just how they are named.
Any other possible hints?
Note: This question is meant to be present in csh, if that makes a difference from what would happen in bash
San Jose State University, San Jose, USA, Allen, CS49c