aboutsummaryrefslogtreecommitdiff
path: root/sh/shrc.d/grep.sh
diff options
context:
space:
mode:
Diffstat (limited to 'sh/shrc.d/grep.sh')
-rw-r--r--sh/shrc.d/grep.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/sh/shrc.d/grep.sh b/sh/shrc.d/grep.sh
index 2f360716..2ccaed69 100644
--- a/sh/shrc.d/grep.sh
+++ b/sh/shrc.d/grep.sh
@@ -5,15 +5,15 @@
# Define function proper
grep() {
+ # Add --binary-files=without-match to gracefully skip binary files
+ [ -e "$HOME"/.cache/grep/binary-files ] &&
+ set -- --binary-files=without-match "$@"
+
# Add --color if the terminal has at least 8 colors
[ -e "$HOME"/.cache/grep/color ] &&
[ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] &&
set -- --color=auto "$@"
- # Add --binary-files=without-match to gracefully skip binary files
- [ -e "$HOME"/.cache/grep/binary-files ] &&
- set -- --binary-files=without-match "$@"
-
# Add --devices=skip to gracefully skip devices
[ -e "$HOME"/.cache/grep/devices ] &&
set -- --devices=skip "$@"