aboutsummaryrefslogtreecommitdiff
path: root/sh/shrc.d/hgrep.sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-05-27 22:52:40 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-05-27 22:52:40 +1200
commitcbbec36d4403dbed6d61232e86b5d4995c8da1fe (patch)
tree9d72ab0bc7b93adb29559624975d519606621f87 /sh/shrc.d/hgrep.sh
parentRemove redundant `|| return` from gd() (diff)
downloaddotfiles-cbbec36d4403dbed6d61232e86b5d4995c8da1fe.tar.gz
dotfiles-cbbec36d4403dbed6d61232e86b5d4995c8da1fe.zip
More error-resistant sd()
Diffstat (limited to 'sh/shrc.d/hgrep.sh')
-rw-r--r--sh/shrc.d/hgrep.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/sh/shrc.d/hgrep.sh b/sh/shrc.d/hgrep.sh
index 1c4c3ec5..fe297ab3 100644
--- a/sh/shrc.d/hgrep.sh
+++ b/sh/shrc.d/hgrep.sh
@@ -6,11 +6,11 @@
hgrep() {
if [ "$#" -eq 0 ] ; then
printf >&2 'hgrep(): Need a pattern\n'
- exit 2
+ return 2
fi
- if ! [ -n "$HISTFILE" ] ; then
+ if [ -z "$HISTFILE" ] ; then
printf >&2 'hgrep(): No HISTFILE\n'
- exit 2
+ return 2
fi
grep "$@" "$HISTFILE"
}