What does “if [ $? -eq 0 ]” mean?
Have you ever found this?
cat version.log |egrep “8.1|9.2|9.0”|grep -v grep >/dev/null if [ $? -eq 0 ]
What is this “$? -eq 0” condition?
Here: ($?) is a return value of previous command. (-eq) means equal. As you might guessed it. And (0) is a success or found.
Conclusion: if the return value of previous command is success or the particular string was found. Usually it followed by: then blablabla..
PS: You can find more information about Shell Command Language here.
Read other posts