天天看點

SHELL判斷檔案是否包含某個字串

  比如說,吾判斷/etc/ld.so.config是否包含指定目錄:

grep "/opt/quantum6/bin" /etc/ld.so.conf >> /dev/null
if [ $? -ne 0 ]; then
    echo not found
fi