Add more portable version of readlink

main
Sean Hickey 2021-08-29 16:11:03 -07:00
parent 2eb461c16e
commit 4d7ab7a25a
1 changed files with 7 additions and 4 deletions

View File

@ -8,9 +8,12 @@ set -o nounset
file=$1
install_dir="${HOME}/.local/bin"
filename=$(basename "$file")
mkdir -p $install_dir
ln -sf "$file" "${install_dir}/${filename}"
path=$(dirname "$file")
filename=$(basename "$file")
canonical_path=d=$(cd $(dirname "$path") && pwd -P)
filename="${canonical_path}/${filename}"
ln -sf "$filename" "${install_dir}/${filename}"