config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 93f608c973a6f1ba933967b39b3a688a7d73f61c
parent 3e260b42c4b5f804ab5579e080736a25d7995cc1
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Fri, 12 Mar 2021 16:05:27 -0800

Simplify, remove, and rename cd shell functions

- Rename cdsub to cds
- Remove goto and cdi
- Simplify cdl and cdr

Diffstat:
Mlocal/shell/.config/shell/cd | 28++++------------------------
1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/local/shell/.config/shell/cd b/local/shell/.config/shell/cd @@ -1,26 +1,6 @@ # cd shell functions -# record directories visited into the PWDLOG file. -cd() { builtin cd "$@" && echo $PWD >> $PWDLOG ;} - -# list unique entries in PWDLOG. -cdl() { - awk -vhome="^$HOME" '$0 != last && $0 != ENVIRON["HOME"] {last=$0; \ - sub(home, "~", $0); printf "%d\t%s\n", FNR, $0 }' $PWDLOG -} - -# cd to entry $1 of PWDLOG -cdi() { - local dir=`head -n ${1:?No index specified} $PWDLOG | tail -1` - cd ${dir:?Non-existent entry} && echo "$dir" -} - -# cd to the latest entry of PWDLOG which matches a regex. -cdr() { - local d="$(egrep $@ $PWDLOG | tail -1)" - cd ${d:?No match} -} - -goto() cd "$(dalias $1)/$2" - -cdsub() cd "$(pwd | sed "s!$1!$2!g")" +cd() { builtin cd "$@" && echo $PWD >>$PWDLOG ;} +cdl() cat $PWDLOG +cdr() cd "$(egrep "${@:-.}" $PWDLOG | tail -1)" +cds() cd "$(pwd | sed "s!$1!$2!g")"