From b19688516c68862bdb24839e568f1e74947b7fa2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 14 Aug 2013 14:53:53 -0400 Subject: mv .config/symlinks.sh .local/bin/config-symlinks --- .local/bin/config-symlinks | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 .local/bin/config-symlinks (limited to '.local') diff --git a/.local/bin/config-symlinks b/.local/bin/config-symlinks new file mode 100755 index 0000000..0831ca3 --- /dev/null +++ b/.local/bin/config-symlinks @@ -0,0 +1,15 @@ +#!/bin/bash + +sed -e '/^\s*$/d' -e '/#/d' symlinks | while read _target _link; do + target="$(sed -rn 's|[^/]+/|../|g;s|/[^/]+$|/|p' <<<"$_link")${_target}" + link="$HOME/$_link" + if [[ -L "$link" ]]; then + rm -f "$link" + fi + if [[ -e "$link" ]]; then + echo "ERROR: file exists: $link" >> /dev/stderr + else + mkdir -p "${link%/*}" + ln -s "$target" "$link" + fi +done -- cgit v1.2.3