config

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

commit 15040bc2dd25cef0e7df30a929b77fa2b633a932
parent ba060201e833c802b20f578a8a6a694b488f1eb7
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Fri,  3 Sep 2021 00:36:55 -0700

Fix rc cd function

When a non-interactive rc would execute this function previously,
it would always return failure causing many scripts to break.

Diffstat:
Mlocal/rc/lib/profile | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/local/rc/lib/profile b/local/rc/lib/profile @@ -34,7 +34,17 @@ PREFIX = /usr/local/ # cd dirlog = $XDG_DATA_HOME/cd -fn cd { builtin cd $* && flag i && pwd >>$dirlog } + +fn cd { + if (builtin cd $*) { + if (flag i) { + pwd >>$dirlog + awd + } + status = '' + } +} + fn cdl { uniq <$dirlog | stest -d } fn cdr { cd `{ cdl | egrep $* | tail -1 } } fn cds { cd `{ pwd | sed s.$1.$2.g } }