diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-21 01:31:52 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-21 01:31:52 +1200 |
commit | 0ed6fddde6b4a2464d83016842859b65f69c1bea (patch) | |
tree | a558a8df5b22961ebbe3cce27f0503bae7ff5bf8 /sh | |
parent | Strip trailing period from sshi(1) hostnames (diff) | |
download | dotfiles-0ed6fddde6b4a2464d83016842859b65f69c1bea.tar.gz dotfiles-0ed6fddde6b4a2464d83016842859b65f69c1bea.zip |
Add --devices and --directories to grep(1) opts
Diffstat (limited to 'sh')
-rw-r--r-- | sh/profile.d/grep.sh | 10 | ||||
-rw-r--r-- | sh/shrc.d/grep.sh | 8 |
2 files changed, 16 insertions, 2 deletions
diff --git a/sh/profile.d/grep.sh b/sh/profile.d/grep.sh index 892351ca..d1ef3ba1 100644 --- a/sh/profile.d/grep.sh +++ b/sh/profile.d/grep.sh @@ -13,8 +13,14 @@ # Iterate through some useful options and create files to show they're # available - for opt in binary-files color exclude exclude-dir ; do - grep -q -- --"$opt" "$gcd"/help || continue + set -- binary-files \ + color \ + devices \ + directories \ + exclude \ + exclude-dir + for opt ; do + grep -Eq -- --"$opt" "$gcd"/help || continue touch -- "$gcd"/"$opt" || exit done fi diff --git a/sh/shrc.d/grep.sh b/sh/shrc.d/grep.sh index df2101aa..2f360716 100644 --- a/sh/shrc.d/grep.sh +++ b/sh/shrc.d/grep.sh @@ -14,6 +14,14 @@ grep() { [ -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 "$@" + + # Add --directories=skip to gracefully skip directories + [ -e "$HOME"/.cache/grep/directories ] && + set -- --directories=skip "$@" + # Add --exclude to ignore .gitignore and .gitmodules files [ -e "$HOME"/.cache/grep/exclude ] && set -- \ |