commit 18357261ef40c39ca81e85698e00e761e686fe19 parent d5f6fd252e9fa14772082453ed4af41ef1037cc9 Author: Jacob R. Edwards <jacobouno@protonmail.com> Date: Thu, 29 Oct 2020 14:18:25 -0700 Fix cdc function Assigning to a local variable always returns `0' thereby causing unexpected results. Diffstat:
| M | aliases/.config/aliases/cd | | | 8 | +++++++- |
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/aliases/.config/aliases/cd b/aliases/.config/aliases/cd @@ -22,4 +22,10 @@ rcd() { } # chdir into curated directories -cdc() { local d="$(smatch $@ <"${XDG_CONFIG_HOME:?unset}/cdc")" && eval cd "${d}" ;} +cdc() { + # When using a `local' variable the exit status is always 0. + # This ocours in the dash shell aswell as ksh, so, I don't + # know if it's actually a bug. Perhaps an old bug which became + # a standard? + _=`smatch -d $@ <${XDG_CONFIG_HOME:?unset}/cdc` && eval cd $_ +}