diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-10-29 08:02:28 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-10-29 08:02:28 +0300 |
commit | 1d7e419ac64c0ba026246fac058ef843c560eea7 (patch) | |
tree | 19bec975bc8135e8c9e500c251c3a57fcb8dd112 /%HOME%/.bash_utils | |
parent | remove more dead code from bash dotfiles (diff) | |
download | linux-home-1d7e419ac64c0ba026246fac058ef843c560eea7.tar.gz linux-home-1d7e419ac64c0ba026246fac058ef843c560eea7.zip |
bugfix & code style
Diffstat (limited to '%HOME%/.bash_utils')
-rw-r--r-- | %HOME%/.bash_utils/path.sh | 10 |
1 files changed, 6 insertions, 4 deletions
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" } |