Should "ls -R" traverse symlinks?

fawcett fawcett at steven.COM
Wed May 17 06:53:28 AEST 1989


In article <KARL.89May11084518 at triceratops.cis.ohio-state.edu>, karl at triceratops.cis.ohio-state.edu (Karl Kleinpaste) writes:
> Given a directory which contains entries like this ("ls -l"):
> 
> total 2
> drwxr-xr-x  2 karl           24 May 11 08:41 real-directory
> lrwxrwxrwx  1 karl           15 May 11 08:41 netnews -> /usr/spool/news
> 
> On a Sun3 running SunOS 3.5.1, "ls -R" does not traverse the "netnews"
> symlink.
> 
> On a Pyramid running OSx 4.[04], "ls -R" *does* traverse the symlink.
> 
> Which is right?

Just for fun, I wnet around the net to all of the different machines we
have here (Sun, Tektronix, Dec 3100, and Intergraph) and looked at the man
pages for ls.  They ALL had the -L option described, which reads:


     -L   If argument is a symbolic link, list the file or direc-
          tory the link references rather than the link itself.

Now, I am not sure if this is standard, but it seems that is four out of
four vendors have it here, it would be at least a de-facto standard.

I looked in both my K&P and "The UNIX(tm) system users manual" by AT&T and
saw no referance to a -L flag on ls.  The AT&T book does list the -R flag,
but does not indicate that if the directory is a link, that the link will
be resolved.

I know this isn't much help, but it looks like it was up to the vendors to
put this in however they felt like, if they did at all.

BTW, the AT&T book is dated 1986.


John W. Fawcett             -----   -----   -----    -----    -----    ------
Software Engineer          /          /    /        /    /   /    /   /     /
Sierra Geophysics, Inc .   -----     /    /---     /-----   /-----   /-----/
P.O. Box 3886                  /    /    /        /   \    /  \     /     /
Seattle, Wa.  98124      -----   -----   -----   /     \  /    \   /     /

Voice: (206) 822-5200    uucp: ..!uw-beaver!sumax!quick!ole!steven!fawcett



More information about the Comp.unix.wizards mailing list