|
From: | Chris F.A. Johnson |
Subject: | Re: Verifying numeric values |
Date: | Mon, 18 Oct 2021 23:53:54 -0400 (EDT) |
User-agent: | Alpine 2.22 (DEB 394 2020-01-19) |
On Mon, 18 Oct 2021, Chris F.A. Johnson 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
Oops! Wrong version. Should be: case ${num//[0-9]/} in ?*|"") echo bad ;; *)echo OK ;; esac -- Chris F.A. Johnson
[Prev in Thread] | Current Thread | [Next in Thread] |