From a2e7e28317c660b9bd220b3317a40bd52dbc63c1 Mon Sep 17 00:00:00 2001 From: ville rantanen Date: Fri, 22 Feb 2013 10:11:51 +0200 Subject: [PATCH] reverse bash history search --- qcd_function | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qcd_function b/qcd_function index 28bcef8..10226fd 100644 --- a/qcd_function +++ b/qcd_function @@ -70,7 +70,7 @@ function qcd() { if [ -z "$1" ] then \cd else - d=$( grep ^"$1" ~/.qcd ~/.bash_cdhistory | head -n 1 ) + d=$( tac ~/.bash_cdhistory | grep -h ^"$1" ~/.qcd - | head -n 1 ) d=${d/*:/} if [ ! -z "$d" ] then \cd "$d"