help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Option immediately followed by a number


From: Greg Wooledge
Subject: Re: Option immediately followed by a number
Date: Sun, 19 Mar 2023 16:07:17 -0400

On Sun, Mar 19, 2023 at 08:02:07PM +0000, uzibalqa wrote:
> I am focused about what to use instead of ("-n") within the case statement.
> 
> Have done
> 
> ("-n"+[[:digit:]])
> 
> But there is something wrong with it.

So you're going with the manual loop instead of getopts?  OK.

What you seem to be pursuing is an extended glob, so the first thing to
know is that you have to enable extended globs (shopt -s extglob).

Next, an extended glob that matches "one or more digits" looks like:

+([[:digit:]])

The parentheses are required.  If you get a syntax error, it's because
extglob isn't turned on in your script.  Mangling the syntax isn't the
answer.  Turning on extglob is.



reply via email to

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