From 651249417c04f1bac5fe6f65bd2dc4eb2480779a Mon Sep 17 00:00:00 2001 From: q Date: Tue, 8 Oct 2013 18:58:51 +0300 Subject: [PATCH] qcd - for previous --- qcd_function | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qcd_function b/qcd_function index c962d33..7466b7a 100644 --- a/qcd_function +++ b/qcd_function @@ -114,7 +114,10 @@ Keeps a history of folders visited in ~/.bash_cdhistory unset OPTSTRING unset OPTIND if [ "$1" = "-" ] - then \cd -; return + then d=$( tail -n 1 ~/.bash_cdhistory ) + d=${d/*:/} + \cd "$d" + return fi d=$( grep $case -h ^"$1" ~/.qcd <( tac ~/.bash_cdhistory ) | head -n 1 ) d=${d/*:/}