Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: test if a parameter is numeric
- X-seq: zsh-users 11207
- From: Andrew Ruder <andy@xxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: test if a parameter is numeric
- Date: Mon, 19 Feb 2007 21:21:38 -0600
- In-reply-to: <E1HJIfJ-0002Ok-Ql@xxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <Xns98D2ADD16C100zzappergmailcom@xxxxxxxxxxx> <070209182939.ZM18654@xxxxxxxxxxxxxxxxxxxxxx> <003d01c74d3f$3bbd7960$6600000a@venti> <E1HG3Bl-0007Ge-DM@xxxxxxxxxx> <E1HJIfJ-0002Ok-Ql@xxxxxxxxxx>
On Tue, Feb 20, 2007 at 12:14:55AM +0000, Lydgate wrote:
> Sorry maybe I'm missing something, but if you need to match more than
> one digit, what's wrong with:
>
> [[ "$1" == [0-9][0-9]* ]]
Lydgate,
shell script expressions != regex expressions. The expression up there
would match:
00
01
02
03abc
but not:
1
2
3
However, I will give you that your expression would work fine in a regex
engine...
There is a ZSH extension that would have more of the effect you are
looking for but its as unportable as most other solutions,
unfortunately.
- Andy
--
Andrew Ruder <andy@xxxxxxxxxxx>
http://www.aeruder.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author