Anthony Sottile wrote:
# Search is for filenames not containing hi, this search is successful **but it exits 1** $ grep -L hi -- f; echo $? f 1 # Search is for filenames not containing hello, this search fails **but it exits 0** $ grep -L hello -- f; echo $? 0
The grep documentation says exit status depends on whether lines (not files) are selected, so grep is conforming to its documentation here. Perhaps grep's documentation and behavior could be changed, though I worry that existing uses of grep might be adversely affected. What is the use case that justifies such a change?