help-bash
[Top][All Lists]
Advanced

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

Re: Conditional actions according to user input


From: alex xmb ratchev
Subject: Re: Conditional actions according to user input
Date: Sun, 23 Apr 2023 11:22:32 +0200

i made some args styles demos some ago ..

take a look ..

greets

On Sun, 23 Apr 2023, 6:28 am uzibalqa, <uzibalqa@proton.me> wrote:

> I have a set of possible user input formats stared in an array
>
> For instance
>
> pary=( "-p+([[:digit:]])"  "-g+([[:digit:]])"  "-q" )
>
> I then want to match these with the actual user inputs
>
>   for gpn in "${pary[@]}"
>   do
>     if [[ "$arg" == $gpn ]]; then
>
>
> What I do after is dependent on whether the user used the digit form (e.g
> "-p+([[:digit:]])")
> or the isolated predicate form (e.g. "-q").
>
> How can I handle the aforementioned functionality in a clear and compact
> way?
>
>
>
>
>
>

Attachment: xmb-args-4-1
Description: Binary data

Attachment: xmb-args-1
Description: Binary data

Attachment: xmb-args-5-2
Description: Binary data

Attachment: xmb-args-5-1
Description: Binary data

Attachment: xmb-args-2
Description: Binary data

Attachment: xmb-args-4-2
Description: Binary data

Attachment: xmb-args-3
Description: Binary data


reply via email to

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