functions.sh: add list_contains function for checking whether a list contains a specific element
SVN-Revision: 12025
This commit is contained in:
parent
4d883da9bf
commit
8c453b693c
1 changed files with 9 additions and 0 deletions
|
@ -24,6 +24,15 @@ append() {
|
||||||
eval "export ${NO_EXPORT:+-n} -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\""
|
eval "export ${NO_EXPORT:+-n} -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list_contains() {
|
||||||
|
local var="$1"
|
||||||
|
local str="$2"
|
||||||
|
local val
|
||||||
|
|
||||||
|
eval "val=\" \${$var} \""
|
||||||
|
[ "${val%% $str *}" != "$val" ]
|
||||||
|
}
|
||||||
|
|
||||||
list_remove() {
|
list_remove() {
|
||||||
local var="$1"
|
local var="$1"
|
||||||
local remove="$2"
|
local remove="$2"
|
||||||
|
|
Loading…
Reference in a new issue