|
From: | uzibalqa |
Subject: | Conditional actions according to user input |
Date: | Sun, 23 Apr 2023 04:27:23 +0000 |
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?
[Prev in Thread] | Current Thread | [Next in Thread] |