blob: a89bc27399519d35c2120a519769b7904835ed68 [file] [log] [blame]
Joao Pereira08f07012015-07-06 18:13:29 -04001has() {
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +00002 local saved_xtrace
3 [[ $- == *x* ]] && saved_xtrace=-x || saved_xtrace=+x
4 set +x
5
Joao Pereira08f07012015-07-06 18:13:29 -04006 local p=$1
7 shift
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +00008 local i ret=1
9 for i in "$@"; do
10 if [[ "${i}" == "${p}" ]]; then
11 ret=0
12 break
13 fi
Joao Pereira08f07012015-07-06 18:13:29 -040014 done
Davide Pesaventoe0edc4c2016-09-13 18:29:52 +000015
16 set ${saved_xtrace}
17 return ${ret}
Joao Pereira08f07012015-07-06 18:13:29 -040018}