aboutsummaryrefslogtreecommitdiff
path: root/sh/shrc.d/hgrep.sh
diff options
context:
space:
mode:
Diffstat (limited to 'sh/shrc.d/hgrep.sh')
-rw-r--r--sh/shrc.d/hgrep.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/sh/shrc.d/hgrep.sh b/sh/shrc.d/hgrep.sh
index 1c4c3ec5..9d7542b4 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
- printf >&2 'hgrep(): No HISTFILE\n'
- exit 2
+ if [ -z "$HISTFILE" ] ; then
+ printf >&2 'hgrep(): HISTFILE unset or null\n'
+ return 2
fi
grep "$@" "$HISTFILE"
}