refactor(install): remove trailing slash from `BIN_DIR` (#3723)

The installation script warns about `BIN_DIR` not being found in `$PATH`
when the users pass a trailing forward slash.

This has been discussed in #1310, #1341, and #3486.

Fixes #3493
This commit is contained in:
César Román 2022-03-10 09:40:33 -08:00 committed by GitHub
parent 43006910c5
commit a85f65473d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -263,7 +263,7 @@ confirm() {
} }
check_bin_dir() { check_bin_dir() {
bin_dir="$1" bin_dir="${1%/}"
if [ ! -d "$BIN_DIR" ]; then if [ ! -d "$BIN_DIR" ]; then
error "Installation location $BIN_DIR does not appear to be a directory" error "Installation location $BIN_DIR does not appear to be a directory"
@ -276,7 +276,7 @@ check_bin_dir() {
good=$( good=$(
IFS=: IFS=:
for path in $PATH; do for path in $PATH; do
if [ "${path}" = "${bin_dir}" ]; then if [ "${path%/}" = "${bin_dir}" ]; then
printf 1 printf 1
break break
fi fi