zsh-users
 help / color / mirror / code / Atom feed
From: fletch@phydeaux.org
To: zsh-users@sunsite.dk
Subject: Re: alias limg='ls *.{jpg,gif}(.N)'
Date: Wed, 1 Mar 2006 09:25:34 -0500 (EST)	[thread overview]
Message-ID: <58026.24.98.225.32.1141223134.squirrel@webmail.phydeaux.org> (raw)
In-Reply-To: <20060228234110.GD25687@prunille.vinc17.org>

> On 2006-02-28 13:17:47 -0500, Chris Johnson wrote:
>> zzapper sent me the following 0.2K:
>> > I was proud of my little alias
>> >
>> > alias limg='ls *.{jpg,gif}(.N)'
>> >
>> > But it has a teeny-weeny fault; if no image is found it lists
>> everything
>> There was some discussion on this in 2004, in which print was suggested
as a replacement to ls.  Try:
>>    http://www.zsh.org/mla/users/2004/msg00621.html
>
> But ls would be better if you want the possibility to add options:
>
> limg() { ls "$@" *.{jpg,gif}(.N) }

limg () {
  local -a images
  images=( *.{jpg,gif,png}(.N) )
  if [[ $#images -eq 0 ]] ; then
    print "No image files found"
  else
    ls "$@" "$images[@]"
  fi
}

-- 
Fletch                | "If you find my answers frightening,       __`'/| 
fletch at phydeaux.org|  Vincent, you should cease askin'          \ o.O'
                      |  scary questions." -- Jules                =(___)=

                      |                                               U





  reply	other threads:[~2006-03-01 14:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-28 18:00 zzapper
2006-02-28 18:17 ` Chris Johnson
2006-02-28 23:41   ` Vincent Lefevre
2006-03-01 14:25     ` fletch [this message]
2006-02-28 18:26 ` Dan Nelson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58026.24.98.225.32.1141223134.squirrel@webmail.phydeaux.org \
    --to=fletch@phydeaux.org \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).