localinstall/localinstall.sh

20 lines
350 B
Bash
Raw Permalink Normal View History

2021-07-16 21:50:50 -07:00
#!/usr/bin/env sh
# Symlink binaries into my ~/.local/bin directory.
set -o errexit
set -o nounset
file=$1
install_dir="${HOME}/.local/bin"
2021-08-29 16:11:03 -07:00
mkdir -p $install_dir
2021-07-16 21:50:50 -07:00
2021-08-29 16:11:03 -07:00
path=$(dirname "$file")
2021-07-16 21:50:50 -07:00
filename=$(basename "$file")
2021-09-06 21:57:33 -07:00
canonical_path=$(cd "$path" && pwd -P)
2021-08-29 16:13:59 -07:00
filepath="${canonical_path}/${filename}"
2021-07-16 21:50:50 -07:00
2021-08-29 16:13:59 -07:00
ln -sf "$filepath" "${install_dir}/${filename}"