mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-28 10:29:37 +02:00
libstd: function added to test membership in an array
This commit is contained in:
@@ -333,6 +333,16 @@ std::parse_yaml() {
|
||||
}
|
||||
}'
|
||||
}
|
||||
|
||||
std::is_member_of_array(){
|
||||
local -- item="$1"
|
||||
local -n array="$2"
|
||||
local -- el=''
|
||||
for el in "${array[@]}"; do
|
||||
[[ "${item}" == "${el}" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
# Local Variables:
|
||||
# mode: sh
|
||||
# sh-basic-offset: 8
|
||||
|
||||
Reference in New Issue
Block a user