blob: e5a5d4c903c70a58ddf4097e38c874b7678eb40f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# Search shell history file for a pattern. If you put your whole HISTFILE
# contents into memory, then you probably don't need this, as you can just do:
#
# $ history | grep PATTERN
#
hgrep() {
if ! (($#)) ; then
printf >&2 '%s: Need a pattern\n' "$FUNCNAME"
exit 2
fi
if ! [[ $HISTFILE ]] ; then
printf >&2 '%s: No HISTFILE\n' "$FUNCNAME"
exit 2
fi
grep "$@" "$HISTFILE"
}
|