关于 =~ 符号解析

用一个shell例子说明=~符号的使用:

先定义一个数组

PLATSS=('center' 'trad')

if [[ "${PLATSS[@]}" =~ ${PLAT} ]];then     #

  do something

else

  do something
fi

解析: '=~' 格式表示左边输出数组值包括右边的值,左右顺序不能调换

posted @ 2015-04-11 17:56  陌上归人的博客  阅读(645)  评论(0编辑  收藏  举报