[EMAIL PROTECTED] wrote:
> I use the following (which I don't use that often to be honest):
> 
> alias lld='find -maxdepth 1 -type d ! -name ".*" -printf "%P\n" | xargs ls 
> -lUd --color'

Thanks for sharing that alias with the group.  But I noticed some
optimizations that could be made to it.

* For an lld alias it would seem simpler to grep ^d from ll output.

    alias lld='ls -l | grep ^d'

  I did not add --color or -U here because it will pick up whatever
  alias for ls that you already have and any options associated with
  it.

* Instead of --color I think it is better to use --color=auto.  This
  way it works into pipes similarly to the -1 being implied when
  writing to a pipe.  Here is the info doc snippet:

     Specifying `--color' and no WHEN is equivalent to `--color=always'.
     Piping a colorized listing through a pager like `more' or `less'
     usually produces unreadable results.  However, using `more -f'
     does seem to work.

* But your example really shines with a simple columnar ls listing
  trying to get just the directories.  Paraphrasing your example into
  an lsd example, and ignoring ARG_MAX for the moment:

  alias lsd='ls -d $(find -maxdepth 1 -type d ! -name ".*" -printf "%P\n")'

I would probably make these either functions or shell scripts.  I
personally prefer shell scripts because then they work with other
things that want external commands.  In either case they could then be
modified to take arguments.

  #!/bin/sh
  ls -d "$@" $(find -maxdepth 1 -type d ! -name ".*" -printf "%P\n")

Bob


_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to