[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Verifying numeric values
From: |
tolugboji |
Subject: |
Verifying numeric values |
Date: |
Tue, 19 Oct 2021 03:50:48 +0000 |
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, October 19th, 2021 at 3:46 AM, Chris F.A. Johnson
<chris@cfajohnson.com> wrote:
> On Tue, 19 Oct 2021, tolugboji via wrote:
>
> > Would like to validate a numeric value (from 1 to 255, for use with
> > terminfo).
> > Am doing ( +([[:digit:]]) ), but I suspect that does not do the job
> > case "$2" in
> > ( +([[:digit:]]) )
>
> case ${num//[0-9]/} in
> ?*) echo bad ;;
> *) echo OK ;;
> esac
>
> ---------------------------------------------------------------
>
> Chris F.A. Johnson
>
Felicitations Chris. I have noticed a syntax error near unexpected token `('
for ` +([[:digit:]]))'. Even when I have `shopt -s extglob' at the beginning
of the file.
- Re: Verifying numeric values, (continued)
- Re: Verifying numeric values, Greg Wooledge, 2021/10/18
- Verifying numeric values, tolugboji, 2021/10/18
- Re: Verifying numeric values, Andy Chu, 2021/10/18
- Re: Verifying numeric values, Greg Wooledge, 2021/10/19
- Verifying numeric values, tolugboji, 2021/10/19
- Verifying numeric values, tolugboji, 2021/10/19
- Re: Verifying numeric values, Andreas Kusalananda Kähäri, 2021/10/19
- Message not available
- Re: Verifying numeric values, Andreas Kusalananda Kähäri, 2021/10/19
- Message not available
- Re: Verifying numeric values, Andreas Kusalananda Kähäri, 2021/10/20
Re: Verifying numeric values, Chris F.A. Johnson, 2021/10/18