help-bash
[Top][All Lists]
Advanced

[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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]