I don't know if this is the correct behavior. Whether or not a symlink
to a directory has its contents shown with GNU ls depends on whether or
not there's a slash present and the flags used:
playground$ mkdir AFolder
playground$ touch AFolder/Horse
playground$ ln -s AFolder SymbolicLinkToAFolder
playground$ ls SymbolicLinkToAFolder
Horse
playground$ ls -l SymbolicLinkToAFolder
lrwxrwxrwx 1 ericpruitt ericpruitt 7 Dec 7 15:35 SymbolicLinkToAFolder
-> AFolder
playground$ ls -l SymbolicLinkToAFolder/
total 0
-rw------- 1 ericpruitt ericpruitt 0 Dec 7 15:34 Horse
Personally, that "-l" made a difference surprised me, but prior to
actually running the command, I would expect "ls ... $SYMLINK" to show
the information for the symlink while "ls ... $SYMLINK/" to show the
contents of the directory. If I recall correctly, historically in things
like Sys V, whether or not a trailing slash was added to a directory
used as a command line argument changed the behaviour of various tools.
Check out
http://unix.stackexchange.com/a/50522 which has a few links to
the POSIX docs.
Eric
Received on Mon Dec 08 2014 - 00:43:36 CET