blob: a89bc27399519d35c2120a519769b7904835ed68 [file] [log] [blame]
Alexander Afanasyev24ed83a2015-03-30 11:06:50 -07001has() {
Davide Pesavento6a81b772017-08-20 18:43:46 -04002 local saved_xtrace
3 [[ $- == *x* ]] && saved_xtrace=-x || saved_xtrace=+x
4 set +x
5
Alexander Afanasyev24ed83a2015-03-30 11:06:50 -07006 local p=$1
7 shift
Davide Pesavento6a81b772017-08-20 18:43:46 -04008 local i ret=1
9 for i in "$@"; do
10 if [[ "${i}" == "${p}" ]]; then
11 ret=0
12 break
13 fi
Alexander Afanasyev24ed83a2015-03-30 11:06:50 -070014 done
Davide Pesavento6a81b772017-08-20 18:43:46 -040015
16 set ${saved_xtrace}
17 return ${ret}
Alexander Afanasyev24ed83a2015-03-30 11:06:50 -070018}