dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

commit 8f5765638bea0aed7e44bb4ddab93ab6000b7bb5 (patch)
parent cf6654ce630c6a2ee9bcf74bf2b3e14a12071fd5
Author: Alex Karle <alex@alexkarle.com>
Date:   Tue, 23 Feb 2021 11:10:23 -0500

install: Create symlinks relative to $HOME, if possible

This is purely cosmetic (makes `ls -la` a bit more narrow, without
$HOME prefixing each symlink).

Diffstat:
Mbin/lnkdot | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bin/lnkdot b/bin/lnkdot @@ -12,13 +12,18 @@ if [ "$#" = "0" ]; then fi DIR="$(dirname "$(dirname "$(readlink -f "$0")")")" +RELDIR="$(echo $DIR | sed "s#^$HOME/##")" lnk() { printf "$1 ... " if [ -e "$HOME/$1" -a ! -L "$HOME/$1" ]; then echo "failed" else - ln -snf $DIR/$1 $HOME/$1 + root=$RELDIR + case $1 in + */*) root=$DIR ;; + esac + ln -snf $root/$1 $HOME/$1 echo "linked" fi }