I'm trying to code a clone of the
ls command as part of a school exercise. I'm wondering why the following output is displayed by
$> ls -- -test_dir /root /root/some-rubbish ls: /root/some-rubbish: Permission denied -test_dir: test.txt /root: ls: root: Permission denied
Specifically, I've noticed that when the searched folder has more than one "part", that is, when is it has at least one
/ between two alphanumerical parts, like
EACCES errors get displayed at the top. Otherwise, they are displayed in alphabetical order like any other listed directory.
I'm currently testing this on OSX 10.8, if that makes any difference.
I hope the above is clear enough. If not, I'll try to clarify.