On Monday 05 February 2007 13:20, James D. Parra wrote:
> > rm -fR <name_dir_softlink>
>
> This is exactly what you said that you did not want to do.
>
> ~~~
>
> That is correct. If I us rm <name_dir_softlink>, rm says it can't
> remove a dir.
> ~~~
>
> Let me correct the above statement. That is what I 'thought' it might
> say, however that is not the case. 'rm' removes the softlink to the
> dir'.
There's a subtlety w.r.t. to symlinks that point to directories. That
is, if the name of the symlink is followed by a slash (and nothing
else), then the target directory is operated on. If no trailing slash is
present, then the symlink itself is used, at least in some
circumstances.
For example:
% mkdir /tmp/sld
% cd /tmp/sld
% mkdir targetDir
% ln -s targetDir symlink
% ls -Fl
total 0
lrwxrwxrwx 1 rschulz users 9 2007-02-05 13:26 symlink -> targetDir/
drwxr-xr-x 2 rschulz users 6 2007-02-05 13:26 targetDir/
% touch targetDir/file{1,2,3}
% ls -l targetDir
total 0
-rw-r--r-- 1 rschulz users 0 2007-02-05 13:26 file1
-rw-r--r-- 1 rschulz users 0 2007-02-05 13:26 file2
-rw-r--r-- 1 rschulz users 0 2007-02-05 13:26 file3
% ls -l symlink
lrwxrwxrwx 1 rschulz users 9 2007-02-05 13:26 symlink -> targetDir
% ls -l symlink/
total 0
-rw-r--r-- 1 rschulz users 0 2007-02-05 13:26 file1
-rw-r--r-- 1 rschulz users 0 2007-02-05 13:26 file2
-rw-r--r-- 1 rschulz users 0 2007-02-05 13:26 file3
% rm symlink
% ls -Fl
total 0
drwxr-xr-x 2 rschulz users 42 2007-02-05 13:26 targetDir/
% ln -s targetDir symlink
% rm symlink/
rm: cannot remove `symlink/': Not a directory
To further compound this idiosyncracy, command completion on a symlink
that refers to a directory adds the trailing slash automatically.
> Thanks again,
>
> ~James
Randall Schulz
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]