summaryrefslogtreecommitdiff
path: root/.local/bin/config-symlinks
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-10-12 14:41:33 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-10-12 14:41:33 -0400
commitb0cdbb3da2c2b36d3c65b00db4eaf5a0d29c2cd6 (patch)
tree6815d1584f909fd52a87f04de26fc179ae7c163e /.local/bin/config-symlinks
parent5f7de477be298f158369862c1a3cc80286fc7e32 (diff)
parent9413cf45dfc7601ace8d448a026a24073b6d73b4 (diff)
Merge branch 'thinkpenguin-par'
Diffstat (limited to '.local/bin/config-symlinks')
-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