From 43f3fd77c8daf23acf86f0fff7ef95f00ec52225 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 27 Jan 2013 16:10:40 -0500 Subject: Create a system for adding symlinks to .config --- .config/symlinks.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 .config/symlinks.sh (limited to '.config/symlinks.sh') diff --git a/.config/symlinks.sh b/.config/symlinks.sh new file mode 100755 index 0000000..a3db6ae --- /dev/null +++ b/.config/symlinks.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +sed -e '/^\s*$/d' -e '/#/d' symlinks | while read _path _link; do + path="$(sed -rn 's|[^/]+/|../|g;s|/[^/]+$|/|p' <<<"$_link")${_path}" + 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 "$path" "$link" + fi +done -- cgit v1.2.3-54-g00ecf