[Top][All Lists]

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

Re: ls -d link/

From: Bob Proulx
Subject: Re: ls -d link/
Date: Thu, 14 Mar 2002 04:15:13 -0700

> >  What do you expect to see here?
> The information "demo is a link to a directory",
> but obviously my way of thinking and
> POSIX's way are different things ;-)

Symbolic links were developed by Mike Accetta in BSD and a wonderful
invention they have proved to be.  POSIX has just standardized on the
"normal" behavior in existence for years and years.  Standards are a
good thing even if you don't agree with them.  They make portability

> > which says to resolve the symlink to destination first.
> Oh! really?
> So why ain't the destination showed by its name in the output?

It was showed by the name you used to list it.  If you had wanted to
list it by the name /home/markus you would have needed to list that.
In UNIX a file may have many names.  All are valid.  A file may be
hard linked or soft linked.  Since soft links were designed to operate
similar to soft links the behavior is also similar.

> >  The destination of demo is /home/markus.  So it listed that.
> No. it did not mention "/home/markus" at all. This is what I zing.
> # ll -d demo/
> drwxr-xr-x   45 markus   users        4153 Mar 12 12:00 demo/
> For me the name "demo" is a representation of a symbolic link.

You could always write a new command which although behaved
differently from the standard commands would do what you wanted it to
do.  The following script comes to mind.  But this is just off the top
of my head and does not account for infinite loops or anything.


  while [ $# -gt 0 ]; do
    case "$1" in
    -*) opts="$opts $1"; shift ;;
    *) break ;;

  if [ $# -gt 0 ]; then
    for i in "$@"; do
      while [ -h "$i" ]; do
        i=$(ls -lgon "$i" | awk '{print$NF}')
      ls $opts $i
    ls $opts $i

> Thinking that "demo/" is something completely different is
> a _decision_ taken by special people who live in a special world: UNIX.

Perhaps you will find kindred souls here.  :-)



reply via email to

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