From de20256f2504de8413ca30c07df425564867c7ce Mon Sep 17 00:00:00 2001 From: Brandon Rodriguez <brodriguez8774@gmail.com> Date: Sun, 25 Oct 2020 20:09:10 -0400 Subject: [PATCH] Improve util script handling of symlinks in paths --- utils.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils.sh b/utils.sh index c61bce7..0f2162b 100755 --- a/utils.sh +++ b/utils.sh @@ -6,7 +6,7 @@ # and checking current user value, and prompts of yes/no user input. # # https://git.brandon-rodriguez.com/scripts/bash/utils - # Version 1.1. + # Version 1.2 ## @@ -204,11 +204,11 @@ function get_absolute_path () { # Handle for directory. # Extra logic to properly handle values of "./" and "../". - local current_dir="$(pwd)" + local current_dir="$(pwd -P)" cd ${1} # Then call this to have consistent symlink handling as files. - return_value="$(cd "$(dirname "$(pwd)")"; pwd -P)/$(basename "$(pwd)")" + return_value="$(cd "$(dirname "$(pwd -P)")"; pwd -P)/$(basename "$(pwd -P)")" # Change back to original location once value is set. cd ${current_dir} -- GitLab