summaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-08-14 14:53:53 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-08-14 14:53:53 -0400
commitb19688516c68862bdb24839e568f1e74947b7fa2 (patch)
treec50a721d841c7afa8bb1ebaa02faf06d0cf246e5 /.local
parentc18638a1ebc629092960729ad1d98e44dd562c94 (diff)
mv .config/symlinks.sh .local/bin/config-symlinks
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/config-symlinks15
1 files changed, 15 insertions, 0 deletions
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