Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: test if a parameter is numeric
- X-seq: zsh-users 11206
- From: Lydgate <zsh@xxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: test if a parameter is numeric
- Date: Tue, 20 Feb 2007 00:14:55 +0000
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:date:from:to:subject:message-id:references:mime-version:content-type:content-disposition:content-transfer-encoding:in-reply-to:user-agent; b=D/dJfo1YEdFpj9SDnZ9RqN7Sj/hFPcT6PkGv7m5lUk7KGbuFEgFYkeDgmrZaDX/dPmxehZvQ7NkyLZ9JxVVChw4aZi2H1eLPH2h7K35m1ansWqErERZ7mqzmOUlzRamy1sFNXt9Ntjada0rRpwnH++7Zc71WQ5eRO9TuDhuqi4U=
- In-reply-to: <E1HG3Bl-0007Ge-DM@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>
On Sun, Feb 11, 2007 at 02:08:40AM +0100, DervishD wrote:
> If you can use "expr", you can do it with "expr", using simple
> regexes. OK, not the fastest method, but should do and should do it
> pretty fast. I use this approach in my "mobs" project. Being bulletproof
> using almost-portable shell scripting is, at least, tricky. And probably
> impossible, for what I've seen...
>
> Raúl Núñez de Arenas Coronado
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]* ]]
Which I think is more portable?
Lydgate
Messages sorted by:
Reverse Date,
Date,
Thread,
Author