bug-coreutils
[Top][All Lists]
Advanced

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

Re: ls display directory context?


From: Bob Proulx
Subject: Re: ls display directory context?
Date: Thu, 20 Jan 2005 01:04:54 -0700
User-agent: Mutt/1.5.6+20040907i

Nic Ferrier wrote:
> This is not so much a bug as a feature enquiry. Sorry about that, I
> don't know who else to ask about this.

This is a good forum for discussion of coreutils features.  But we try
to keep basic shell programming quesions in other forums such as the
comp.unix.shell news group.

> Is there any reason (apart from POSIX compliance) why ls cannot output
> file lists with the directory context attached to the file?
> 
> For example:
> 
>   $ cd somedir
>   $ ls --with-dir-ctx childdir 
>   childdir/in.txt childdir/my.txt childdir/craft.txt

Hmm...  I think it can do that already.  Do you mean something like
this?

Set up the trial:

  mkdir /tmp/trial/childdir
  cd /tmp/trial
  touch childdir/{in.txt,my.txt,craft.txt}

  find
  .
  ./childdir
  ./childdir/craft.txt
  ./childdir/in.txt
  ./childdir/my.txt

Then try it:

  ls -D */*
  childdir/craft.txt  childdir/in.txt  childdir/my.txt

That seems to do what you want.  However you may be thinking of
something arbitrarily deep.  For that find would be better.  Here is
the simple way that I would normally use.

  find . -type f -print
  ./childdir/craft.txt
  ./childdir/in.txt
  ./childdir/my.txt

> This simple feature would replace a lot of complex find invocations
> for me.

Such as?  Perhaps you could share your case.  Another person on the
mailing list may have an alternative suggestion that may help.

> If this is not a lame idea I would be prepared to provide a patch to
> GNU ls.
> 
> So: is it a lame idea?

Well, on the surface it seems like what you want to do does not need
another option to ls.  So I am not convinced.

Bob




reply via email to

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