Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: var expansion in glob pattern?
- X-seq: zsh-users 4768
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Sven Guckes <guckes@xxxxxxxxxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: Re: var expansion in glob pattern?
- Date: Sat, 23 Mar 2002 19:54:17 +0000
- In-reply-to: <1020323193618.ZM28746@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20020323185649.GA12320@xxxxxxxxxxxxxxxxxxxxxx> <1020323193618.ZM28746@xxxxxxxxxxxxxxxxxxxxxxx>
On Mar 23, 7:36pm, Bart Schaefer wrote:
}
} except that passing [the glob expression] as the argument to "ls"
} may do the wrong thing when there are no matches at all.
Hmm, just noticed that my solution is also off when there are no matches,
because "${#${(f)...}}" didn't behave the way I expected on empty string
(returns 1 rather than 0). So really:
j=0
for i in 1 2 3 4 5 10 15 20 25 30 35 40 35 40 45 50; do
print ${(l:3:)i}k : "$[${#${(f)$(print -l x *(N.Lk-${i}Lk+${j}))}}-1]"
((j=i-1))
done
print Rest : "$[${#${(f)$(print -l x *(N.Lk+${j}))}}-1]"
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author