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"