[KLUG Members] Testing for files with symbolic links

Bruce Smith members@kalamazoolinux.org
Fri, 16 Nov 2001 08:18:14 -0500


> I want to test for files with symbolic links in a shell script. 
> I tried find, stat, symlinks with no luck.  I tried the following
> link test:
> [ -L $HOME/linked_dir/linked_file ]  but it returns "1" when I know 
> this directory/file is symbolically linked to another directory. 
> The above test should work.  Is there must be a simple way to test links?

The "-L" should work.  Is the file linked, or it's parent directory?  (both?)

Can you be more specific and display the actual script code and a "ls -l" 
of all directories and files involved?

--------------------------------------------
Bruce Smith                bruce@armintl.com
System Administrator / Network Administrator
Armstrong International, Inc.
Three Rivers, Michigan  49093  USA
http://www.armstrong-intl.com/
--------------------------------------------