I have been trying to write a script that will checks if the specific content is not found in specific files/folders then it should print "failed". else it should print "success". However, the following script causing multiple errors.
if [[ ( ! grep '/example.com' /opt/nfs &>/dev/null ) || ( ! grep -R '/example.com' /data &>/dev/null) ]]
then
echo "Failed"
else
echo "Passed"
fi
Can anyone tell me why it's causing errors and is there anyway to eliminate the errors and get the expected output?
UPDATE: I'm getting following errors:
s.sh: line 1: conditional binary operator expected
s.sh: line 1: expected `)'
s.sh: line 1: syntax error near `'/example.com''
s.sh: line 1: `if [[ ( ! grep '/example.com' /opt/nfs &>/dev/null ) || ( ! grep -R '/example.com' /data &>/dev/null) ]]'