* alias limg='ls *.{jpg,gif}(.N)'
@ 2006-02-28 18:00 zzapper
2006-02-28 18:17 ` Chris Johnson
2006-02-28 18:26 ` Dan Nelson
0 siblings, 2 replies; 5+ messages in thread
From: zzapper @ 2006-02-28 18:00 UTC (permalink / raw)
To: zsh-users
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
--
zzapper
Success for Techies
http://SuccessTheory.com/tips/ vim, zsh & success tips
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: alias limg='ls *.{jpg,gif}(.N)'
2006-02-28 18:00 alias limg='ls *.{jpg,gif}(.N)' zzapper
@ 2006-02-28 18:17 ` Chris Johnson
2006-02-28 23:41 ` Vincent Lefevre
2006-02-28 18:26 ` Dan Nelson
1 sibling, 1 reply; 5+ messages in thread
From: Chris Johnson @ 2006-02-28 18:17 UTC (permalink / raw)
To: zsh-users
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
--
Chris Johnson
cjohnson@cs.utk.edu
http://www.cs.utk.edu/~cjohnson
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: alias limg='ls *.{jpg,gif}(.N)'
2006-02-28 18:00 alias limg='ls *.{jpg,gif}(.N)' zzapper
2006-02-28 18:17 ` Chris Johnson
@ 2006-02-28 18:26 ` Dan Nelson
1 sibling, 0 replies; 5+ messages in thread
From: Dan Nelson @ 2006-02-28 18:26 UTC (permalink / raw)
To: zzapper; +Cc: zsh-users
In the last episode (Feb 28), zzapper said:
> 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
How about:
alias limg='ls *.(jpg|gif)(.)'
which uses a single glob pattern and no NULL_GLOB, so zsh will complain
if the pattern doesn't match anything.
--
Dan Nelson
dnelson@allantgroup.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: alias limg='ls *.{jpg,gif}(.N)'
2006-02-28 18:17 ` Chris Johnson
@ 2006-02-28 23:41 ` Vincent Lefevre
2006-03-01 14:25 ` fletch
0 siblings, 1 reply; 5+ messages in thread
From: Vincent Lefevre @ 2006-02-28 23:41 UTC (permalink / raw)
To: zsh-users
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) }
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: alias limg='ls *.{jpg,gif}(.N)'
2006-02-28 23:41 ` Vincent Lefevre
@ 2006-03-01 14:25 ` fletch
0 siblings, 0 replies; 5+ messages in thread
From: fletch @ 2006-03-01 14:25 UTC (permalink / raw)
To: zsh-users
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-03-01 14:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-28 18:00 alias limg='ls *.{jpg,gif}(.N)' zzapper
2006-02-28 18:17 ` Chris Johnson
2006-02-28 23:41 ` Vincent Lefevre
2006-03-01 14:25 ` fletch
2006-02-28 18:26 ` Dan Nelson
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).