blob: a89bc27399519d35c2120a519769b7904835ed68 [file] [log] [blame]
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -04001has() {
Davide Pesavento09348882016-09-17 02:39:44 +02002 local saved_xtrace
3 [[ $- == *x* ]] && saved_xtrace=-x || saved_xtrace=+x
4 set +x
5
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -04006 local p=$1
7 shift
Davide Pesavento09348882016-09-17 02:39:44 +02008 local i ret=1
9 for i in "$@"; do
10 if [[ "${i}" == "${p}" ]]; then
11 ret=0
12 break
13 fi
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -040014 done
Davide Pesavento09348882016-09-17 02:39:44 +020015
16 set ${saved_xtrace}
17 return ${ret}
Alexander Afanasyevb346ddb2015-06-03 00:52:03 -040018}