更新时间:2023-11-28 22:37:46
在bash 4,你能做的最接近的事是使用关联数组。
With bash 4, the closest thing you can do is use associative arrays.
declare -A map
for name in hello world my name is perseus; do
map["$name"]=1
done
tgt=henry
if [[ ${map["$tgt"]} ]] ; then
: found
fi