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: Jeffrey Walton
Subject: Re: Option immediately followed by a number
Date: Sun, 19 Mar 2023 18:31:08 -0400

On Sun, Mar 19, 2023 at 4:03 PM uzibalqa <uzibalqa@proton.me> wrote:
> ------- Original Message -------
> On Monday, March 20th, 2023 at 7:42 AM, alex xmb ratchev <fxmbsw7@gmail.com> 
> wrote:
> > On Sun, Mar 19, 2023, 8:08 PM uzibalqa <uzibalqa@proton.me> wrote:
> >
> > > I want to match a string composed of "-n" immediately followed by a 
> > > number. Meaning at least one number after "-n".
> > >
> > > For instance "-n8", "-n21", "-n34"
> > >
> > > How can I make a glob pattern that matches the above description that I 
> > > can use with the case statement?
> > >
> > > case $opt in
> > > ("-n") do-this ;;
> > > esac
> >
> > n=${opt#-n}
>
> 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.

Shellcheck may be able to help.

You should also provide a reduced example script for folks to run
instead of a snippet.

Jeff



reply via email to

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