You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* grep: shortcut exit path for -q
* -q flag of grep is concerned if a match was found in any file
* The program can terminate after the first match without searching in subsequent files
* GNU grep behaves in this way; strace on my Linux system confirms that only the 1st file in argument list is opened when that file contains a match
%strace grep -q perl ar awk 2> trace # gnu grep
%grep open trace
...
openat(AT_FDCWD, "ar", _RDONLY|O_NOCTTY|O_LARGEFILE) = 3
^^^ final openat() in process
* avoid printing $Mult flag as part of string for grep -c
0 commit comments