blob: a89bc27399519d35c2120a519769b7904835ed68 [file] [log] [blame]
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -07001has() {
Alexander Afanasyeve0ab3f92016-10-20 13:29:39 -07002 local saved_xtrace
3 [[ $- == *x* ]] && saved_xtrace=-x || saved_xtrace=+x
4 set +x
5
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -07006 local p=$1
7 shift
Alexander Afanasyeve0ab3f92016-10-20 13:29:39 -07008 local i ret=1
9 for i in "$@"; do
10 if [[ "${i}" == "${p}" ]]; then
11 ret=0
12 break
13 fi
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -070014 done
Alexander Afanasyeve0ab3f92016-10-20 13:29:39 -070015
16 set ${saved_xtrace}
17 return ${ret}
Yuanzhi Gaodd516fe2015-04-23 04:18:24 -070018}