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: alex xmb ratchev
Subject: Re: Option immediately followed by a number
Date: Sun, 19 Mar 2023 21:07:04 +0100

On Sun, Mar 19, 2023, 9:05 PM alex xmb ratchev <fxmbsw7@gmail.com> wrote:

>
>
> On Sun, Mar 19, 2023, 9:02 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.
>>
>>
>> "-n"+([[:digit:]]))
>>
>
> extglob
>

or in ?( .. ) to make it optional

>
>>


reply via email to

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