There is this line in a shell script i have seen:
grep -e ERROR ${LOG_DIR_PATH}/${LOG_NAME} > /dev/null
if [ $? -eq 0 ]
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s checking the return value (
$?) ofgrep. In this case it’s comparing it to 0 (success).Usually when you see something like this (checking the return value of grep) it’s checking to see whether the particular string was detected. Although the redirect to
/dev/nullisn’t necessary, the same thing can be accomplished using-q.