blob: e5a5d4c903c70a58ddf4097e38c874b7678eb40f (
plain) (
tree)
|
|
# 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"
}
|