aboutsummaryrefslogtreecommitdiffstats
path: root/cdlog.sh
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-01-18 12:43:42 -0800
committerKaz Kylheku <kaz@kylheku.com>2024-01-18 12:43:42 -0800
commitf8304eb1eb57b1489a667595700a3e58db614399 (patch)
tree507f2ef9121cd3cd44007c4260a06a746400257f /cdlog.sh
parent667a006f81d05acf812910085cb8f55a4ee8c512 (diff)
downloadcdlog-f8304eb1eb57b1489a667595700a3e58db614399.tar.gz
cdlog-f8304eb1eb57b1489a667595700a3e58db614399.tar.bz2
cdlog-f8304eb1eb57b1489a667595700a3e58db614399.zip
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.
Diffstat (limited to 'cdlog.sh')
-rw-r--r--cdlog.sh8
1 files changed, 4 insertions, 4 deletions
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