[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fileutils: inconsistent behaviour stripping / from end of filenames

From: Edward Avis
Subject: Re: fileutils: inconsistent behaviour stripping / from end of filenames
Date: Thu, 13 Sep 2001 09:18:37 +0100 (BST)

Hash: SHA1

On Wed, 12 Sep 2001, Paul Eggert wrote:

>>If POSIX mandates that rm should choke on trailing slashes after a
>>directory name, then POSIX is stupid and this behaviour should be
>>reserved for when POSIXLY_CORRECT is set.
>In POSIX's defense, POSIX is attempting to be consistent.
>If FOO is a symbolic link to a directory, then "ls -l FOO" talks about
>the symbolic link, but "ls -l FOO/" talks about the directory, i.e. it
>is roughly equivalent to "ls -l FOO/.".  This is longstanding tradition.

That is reasonable, if a little obscure.

>For consistency, then, POSIX says that "rm FOO" should remove the
>symbolic link, and that "rm FOO/" should attempt to remove "FOO/."
>(unsuccessfully, of course).

What does POSIX say about 'rm -r FOO' and 'rm -r FOO/'?

Anyway, all this is okay for symbolic links but it shouldn't mess up the
handling of ordinary directories.  If DOUGAL is a directory, then
'rm -r DOUGAL', 'rm -r DOUGAL/', 'rm -r DOUGAL//' and so on should all
work.  Since DOUGAL/. is just a hard link to DOUGAL itself, this is
consistent with what happens for symlinks.

Perhaps I have misunderstood.  I thought you were saying that trailing
slashes on ordinary directory names would stop working.

>>It would be very disconcerting for bash to complete characters and
>>then remove them again without asking.
>I also am leery of this part of zsh's behavior.  But if it is useful and
>if some people like it, I see no harm in adding it to Bash as an option.

You could apply the same criterion to any of zsh's features.  Why not
just replace bash with zsh :-)?

- -- 
Ed Avis <address@hidden>
Finger for PGP key
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org


reply via email to

[Prev in Thread] Current Thread [Next in Thread]