Skip to content

Instantly share code, notes, and snippets.

@issm
Last active September 26, 2015 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save issm/1071501 to your computer and use it in GitHub Desktop.
Save issm/1071501 to your computer and use it in GitHub Desktop.
function hs () {
n_hist_default=1000000
n_hist=${1#-}
if [ $1 != '' -a $n_hist != $1 ]; then
shift
if [ $n_hist -gt 0 ]; then
else
n_hist=$n_hist_default
fi
else
n_hist=$n_hist_default
fi
words=($*)
greps=""
for w in $words; do
greps="${greps} | grep ${w}"
done
# echo n: $n_hist
# echo w: $words
eval "history -${n_hist} ${greps}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment