I am passing the variable akms
to the function named sufx
. I am able te correctly capture the second array element and set the variable fskl
.
I want the capability of setting the variable verbiage
according to the numeric value of -v
. How can I do this for the function sufx
? Currently verbiage
is just taking a string value.
akms=("-v 3" "INCLUDE")
sufx akms
Here is the function
sufx ()
{
typeset -n _akms="$1"
Capture INCLUDE or EXCLUDE option for grep
local fskl="" verbiage=0
for s in "${_akms[@]}"; do
case $s in
("XCL"|"INCL"|"INCLUDE") fskl="INCLUDE" ;;
("NCL"|"EXCL"|"EXCLUDE") fskl="EXCLUDE" ;;
() verbiage=${s#-v} ;;
esac
done
}
(-v([[:blank:]])+([0-9])+) verbiage="${s//[^0-9]}" ;;
in the case statement, but there is some syntax problem with it. – Fatipati Apr 02 '23 at 18:42case
and how to use regular expression patterns with extended test brackets[[ … =~ … ]]
– Raffa Apr 02 '23 at 18:49case ... esac
– Raffa Apr 02 '23 at 19:46