From f8304eb1eb57b1489a667595700a3e58db614399 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 18 Jan 2024 12:43:42 -0800 Subject: Change semantics of swap implementation. * cdlog.sh (cdlog.chdir): When the user changes to $c1, let's not involve $c2 but just effectively exchange the current working directory and $c1. --- cdlog.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cdlog.sh') diff --git a/cdlog.sh b/cdlog.sh index 403dc04..f65a90e 100644 --- a/cdlog.sh +++ b/cdlog.sh @@ -30,10 +30,10 @@ cdlog.chdir() # only if we successfully change to a different # directory do the following - if [ "$cur" == "$c2" ] && [ "$PWD" == "$c1" ] ; then - # Special case: if we changed to the directory that is second - # in the cdlog, then just swap between those two. - c2=$PWD + if [ "$PWD" == "$c1" ] ; then + # If we changed to the directory that is most + # recent in the cdlog, then we just replace that + # entry by the one we are coming from. c1=$cur else # Otherwise rotate through all -- cgit v1.2.3