bug-fileutils
[Top][All Lists]
Advanced

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

Re: ls


From: Bob Proulx
Subject: Re: ls
Date: Wed, 30 Oct 2002 16:45:35 -0700
User-agent: Mutt/1.4i

address@hidden <address@hidden> [2002-10-26 21:50:03 +0200]:
> Hi,
> 
> this may not be a bug - and if it is one, it isn't of big importance but
> I thought I'd tell you about that:
> 
> I am using ls (fileutils) 4.1.11 and I wonder why
> 
> ls -d /sbin/
> 
> shows TWO slashes at the end:
> 
> drwxr-xr-x    2 root     root         4.0K 2002-10-26 15:05 /sbin//
> 
> while ls -d /sbin just shows it correctly:
> 
> drwxr-xr-x    2 root     root         4.0K 2002-10-26 15:05 /sbin/

You seem to imply that one is correct and the other is incorrect.
Quite an assumption.  Actually both are exactly equivalent.

But as to why, it is because you passed on the command line to ls a
string of characters which included a tailing / character.  That
string was stat()'d to get information about it.  The information
returned said it was a directory.

You appear to have an alias for 'ls'.  What does this say?  You must
have it aliased to at least 'ls -l -F' because of the output.

  type ls

Avoiding your alias by quoting ls, you should see something like
this.

  \ls -ld /sbin/
  drwxr-xr-x    2 root     root         4096 Oct  3 15:42 /sbin/

You must be including the -F option which does this:

  -F, --classify             append indicator (one of */=@|) to entries

Since stat() said that the thing you entered on the command line was a
directory the -F option added a / indicator to the end of it.

As to whether this is good or bad that is a different question.  It
has only recently been a question at all because newer command line
shells are now adding a trailing slash upon filename completion which
had not previously existed and therefore no one had ever run into this
case during the development of ls.

Bob




reply via email to

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