g: show all file names when grepping
When grep gets a single file argument, it does not show the file name. This makes seeing the file name in the output of 'g' difficult. Pass a spare /dev/null to each invocation of g, in order to force it to show the file name.
This commit is contained in:
parent
251c3cfd61
commit
1290c534be
1 changed files with 2 additions and 1 deletions
3
rc/bin/g
3
rc/bin/g
|
@ -23,6 +23,7 @@ shift
|
|||
|
||||
suffixes='\.([bcChlmsy]|asm|awk|cc|cgi|cpp|cs|go|goc|hs|java|lua|lx|mk|ml|mli|ms|myr|pl|py|rc|sh|tex|xy)$'
|
||||
fullnames='(^|/)mkfile$'
|
||||
repodirs='(^|/)(.git|.hg)($|/)'
|
||||
switch($#*){
|
||||
case 0
|
||||
walk -f $recurse | grep -e $fullnames -e $suffixes >[2]/dev/null
|
||||
|
@ -34,4 +35,4 @@ case *
|
|||
if not
|
||||
echo $f
|
||||
}
|
||||
} | xargs grep -n $flags -- $pattern
|
||||
} | grep -v $repodirs | xargs grep -n $flags -- $pattern /dev/null
|
||||
|
|
Loading…
Reference in a new issue