implement hasElement()
This commit is contained in:
parent
476686ea4e
commit
712c340cdd
|
@ -32,6 +32,20 @@ function die() {
|
||||||
exit ${2}
|
exit ${2}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Checks whether a defined variable contain specified element or not
|
||||||
|
# Parameters: %variable% %element%
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
function hasElement() {
|
||||||
|
local NEEDLE=${1}
|
||||||
|
shift
|
||||||
|
local X
|
||||||
|
for X in "${@}"; do
|
||||||
|
[ "${X}" = "${NEEDLE}" ] && return 0
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Checks whether a supplied variable is defined or not
|
# Checks whether a supplied variable is defined or not
|
||||||
# Parameters: %variable%
|
# Parameters: %variable%
|
||||||
|
|
Loading…
Reference in New Issue