Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: test if a parameter is numeric
- X-seq: zsh-users 11183
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: test if a parameter is numeric
- Date: Fri, 09 Feb 2007 18:29:38 -0800
- In-reply-to: <Xns98D2ADD16C100zzappergmailcom@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <Xns98D2ADD16C100zzappergmailcom@xxxxxxxxxxx>
On Feb 9, 5:05pm, zzapper wrote:
}
} I just want to test if a parameter is numeric
}
} if [[ "$1" == [0-9] ]]
Better:
if [[ "$1" = <-> ]]
This is a zsh-ism, so it's not cross-shell portable, but the pattern <->
matches any string having any number of digits and only digits.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author