Kent West wrote:
Stefan O'Rear wrote:On Fri, Aug 20, 2004 at 09:46:52PM -0500, Kent West wrote:How can I test to see if the word "tuber" is in the /etc/passwd file, reliably, and take an action if it is, and take a different action if it's not, in a bash shell script?if grep -q '\<tuber\>' /etc/passwd thenecho 'NOOOOOO! THERE ARE POTATOES IN MY PASSWORD! ABORT! ABORT!' | mail rootelse echo "foo. Foo? passwords are clean..." | mail root fi
How do I test to make sure the name is in two files? Like so?if ( ! grep -q '\<tuber\>' /etc/passwd ) or ( ! grep -q '\<tuber\>' /etc/shadow )
then echo "Error: One or both files are missing 'tuber'" | mail root exit 1 fi Thanks! -- Kent