God pokes at camera

A little caveat. Find doesn’t seem to like symlinks. Since /media/cdrom is a symlink to /media/cdrom0, using /media/cdrom0 with find will work. I spent far too much time figuring this out.


frodo$ cd /media/cdrom
frodo$ find `pwd` -iname ’*.jpg’
# hmmm, there are images here.
frodo$ find . -iname ’*.jpg’ # this works…
./common/0.jpg
./common/clip_art/e_mail/75/ec1.jpg
./common/clip_art/e_mail/75/ec2.jpg
...

Another reason to sigh about this FHS /media schema.

66.93.40.92
You can also achieve the same result with “find -H /media/cdrom -iname ’*.jpg’”.
Comment by Anonymous
130.237.60.70
The problem is that most shells by default don’t resolve symlinked directories to a canonical path. This ‘feature’ causes all sorts of havoc since ’..’ follows uses the symlinks parent in the cd builtin, but uses the parent of the canonical path when doing IO redirection, or when used as an argument for e.g. the ls command. Since it is completely impossible to never resolve symlinked directories to it’s canonical path in all situations, I think it is a huge mistake by most shells to do this sometimes, and sometimes not, since it leads to all kinds of silly bugs.
Comment by Axel