From c6c38c30585a453512124b732f91480abebffac3 Mon Sep 17 00:00:00 2001 From: tomeichlersmith Date: Tue, 5 Sep 2023 11:54:48 -0500 Subject: [PATCH] if prefix is provided, get its fullpath using cd and pwd --- install | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/install b/install index 5a2a170..d07931a 100755 --- a/install +++ b/install @@ -96,7 +96,8 @@ while [ "$#" -gt 0 ]; do ;; -p | --prefix) if [ -n "$2" ]; then - prefix="$2" + [ -d "$2" ] || mkdir -p "$2" + prefix="$(cd "$2" && pwd -P)" shift shift fi @@ -119,11 +120,9 @@ if [ -z "${prefix}" ]; then fi fi -if [ ! -d "${prefix}" ]; then - if ! mkdir -p "${prefix}"; then - _denv_error "Cannot write into ${prefix}, permission denied" - exit 1 - fi +if [ ! -w "${prefix}" ]; then + _denv_error "Cannot write into ${prefix}, permission denied" + exit 1 fi completion_dest_path="${prefix}/share/bash-completion/completions/"