bug-fileutils
[Top][All Lists]
Advanced

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

Re: ls -d link/


From: Cgweav
Subject: Re: ls -d link/
Date: Wed, 20 Mar 2002 15:01:11 EST

I agree with Markus that the standard behavior is non-intuitive.
I expect to see the same output from ls -l for a symbolic link to a directory whether the basename passed to ls as an argument has '/' appended to it or not.

One can work around this with a shell script wrapper that uses the
shell's type identifier tests. bash's -d test identifies both real subdirs
and symbolic links to subdirs, and you can pass any other options
(like "-l") onto ls without the -d switch if you have already identified
which directory entries are sub-directories.

FYI: testing this just now, I discovered that the -d switch to ls
does not actually work here, neither in the ls from fileutils-4.0
nor the ls from fileutils-4.1.7.

cd /tmp
mkdir test1
cat "test" > test1/test
mkdir test2
cat "test" > test2/test
ln -s test1 test3

alias ls="ls -p color=auto";export ls

ls
test1/
test2/
test3@

ls -d
"./"

That's it. ls -d only reports the directory entry for the current
directory. (ls -ld also only reports the directory entry for the
current directory, although more verbosely.) Perhaps some
interation with "-p"?

linux-2.2.20
glibc-2.1.3
gcc-2.91.66
binutils-2.9.0.1.25
-O2 [etc]

Hth,

Clayton Weaver
<mailto: address@hidden>

"Everyone is ignorant, just about different things."  Will Rogers

reply via email to

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