From 1d7e419ac64c0ba026246fac058ef843c560eea7 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 29 Oct 2016 08:02:28 +0300 Subject: bugfix & code style --- %HOME%/.bash_utils/path.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to '%HOME%/.bash_utils') diff --git a/%HOME%/.bash_utils/path.sh b/%HOME%/.bash_utils/path.sh index 644ed00..b9e78b6 100644 --- a/%HOME%/.bash_utils/path.sh +++ b/%HOME%/.bash_utils/path.sh @@ -17,7 +17,7 @@ add_missing_path() ( while IFS= read -d '' -r path; do new_paths+=("$path") - done < <( readlink --zero --canonicalize-missing "$@" ) + done < <( readlink --zero --canonicalize-missing -- "$@" ) for path; do if str_contains "$path" ':'; then @@ -30,7 +30,7 @@ add_missing_path() ( while IFS= read -d '' -r path; do old_paths[$path]=1 - done < <( str_split -z -- "${PATH-}" ':' | xargs --null readlink --zero --canonicalize-missing ) + done < <( str_split -z -- "${PATH-}" ':' | xargs --null readlink --zero --canonicalize-missing -- ) for path in ${new_paths[@]+"${new_paths[@]}"}; do old_paths[$path]=1 @@ -40,6 +40,8 @@ add_missing_path() ( ) add_path() { - PATH="$( add_missing_path "$@" )" || return $? - export PATH + local new_path + + new_path="$( add_missing_path "$@" )" \ + && export PATH="$new_path" } -- cgit v1.2.3