From 8d8b27b2b21db91f28e45fe21051a346100d35ec Mon Sep 17 00:00:00 2001 From: Lucas Larson Date: Tue, 21 May 2024 11:25:27 -0400 Subject: [PATCH] refactor: reduce variable use Signed-off-by: Lucas Larson --- custom/aliases.zsh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/custom/aliases.zsh b/custom/aliases.zsh index 60f3952d62..f1efaef556 100644 --- a/custom/aliases.zsh +++ b/custom/aliases.zsh @@ -111,10 +111,9 @@ alias ....='cd -- ../../..' alias .....='cd -- ../../../..' cdp() { - cd_from="$(command pwd -L)" cd_to="$(command pwd -P)" - if test "${cd_from-}" != "${cd_to-}"; then - printf -- 'moving from \342\200\230%s\342\200\231\n' "${cd_from-}" + if test "${PWD-}" != "${cd_to-}"; then + printf -- 'moving from \342\200\230%s\342\200\231\n' "${PWD-}" cd -- "${cd_to-}" || { printf -- 'unable to perform this operation\n' return 1 @@ -122,10 +121,9 @@ cdp() { printf -- ' into \342\200\230%s\342\200\231\n' "${cd_to-}" else printf -- 'already in unaliased directory ' - printf -- '\342\200\230%s\342\200\231\n' "${cd_from-}" + printf -- '\342\200\230%s\342\200\231\n' "${PWD-}" return 1 fi - unset -v -- cd_from unset -v -- cd_to }