xml_path=`grep -l -F -i 'yes' "${i}"`
判断为空
if [ -z $xml_path ]
或
if [ $? == 1 ]
判断不为空
if [ ! -z $xml_path ]
或
if [ $? == 0 ]
对于grep 的返回结果 -n 与 ! -z 并不是一回事,也就是判断 不为空时 使用 -n 不准确。
xml_path=`grep -l -F -i 'yes' "${i}"`
判断为空
if [ -z $xml_path ]
或
if [ $? == 1 ]
判断不为空
if [ ! -z $xml_path ]
或
if [ $? == 0 ]
对于grep 的返回结果 -n 与 ! -z 并不是一回事,也就是判断 不为空时 使用 -n 不准确。