I have the same need as 
http://stackoverflow.com/questions/14631794/check-if-file-contains-some-text-not-regex-in-unix#comment20438757_14631832.


$ cat file
foo
bar

$ echo "$fixed_string"
bar
foo

$ grep -Fzq "$fixed_string" file && echo "Matched" || echo "Not matched"
Matched # false positive, -z doesn't apply to -F


$ [[ "$(cat file)" = *"$fixed_string"* ]] && echo "Matched" || echo "not 
matched"
not matched # my workaround

Reply via email to