commit 49b5d033f05e528b30d920eb9c9868e3291d4442
parent bc293a6aab930185942964bc40120c98c93dbd7d
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Mon, 15 Mar 2021 01:44:59 -0700
Remove unwanted entries from the cd* shell functions
The cdl function now uses uniq(1) to remove repeat entries and
stest(1) to remove non-existent entries. cdr now uses cdl and thus
has the same properties.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/local/shell/.config/shell/cd b/local/shell/.config/shell/cd
@@ -1,6 +1,6 @@
# cd shell functions
cd() { builtin cd "$@" && echo $PWD >>$PWDLOG ;}
-cdl() cat $PWDLOG
-cdr() cd "$(egrep "${@:-.}" $PWDLOG | tail -1)"
+cdl() { uniq <$PWDLOG | stest -d ;}
+cdr() cd "$(cdl | egrep "${@:-.}" | tail -1)"
cds() cd "$(pwd | sed "s!$1!$2!g")"