#!/bin/sh# Note: the dotfiles repo must be located at $HOME/dotfiles for this script to work properly# safe link w/ recursive directory creationslnr(){target=$HOME/dotfiles/$1shift# discard $1 so we can loop through all arguments afterwardswhiletest$# -gt 0;dolink=$HOME/$1if[-h"$link"];thenecho"'$1' already linked"elif[-e"$link"];thenecho"'$1' already exists">&2elsemkdir -p$(dirname"$link")# create any directories leading to the link fileln -s"$target""$link"fishift# discard this argumentdone}# cd into home directorycdslnr .bashrc .bashrcslnr .inputrc .inputrcslnr .config/bash .config/bashslnr .config/git .config/gitslnr .config/nvim .config/nvimslnr .hgrc .hgrcslnr .ssh/config .ssh/configslnr .config/pijul/config.toml .config/pijul/config.toml# reload so that systemd picks up any new servicessystemctl --user daemon-reload