From 872ada38529cca7f190767d4fba7450a1ebff857 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 21 Apr 2014 11:57:28 -0400 Subject: make the config-symlinks script report errors --- .local/bin/config-symlinks | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.local/bin/config-symlinks b/.local/bin/config-symlinks index 0831ca3..7d889f0 100755 --- a/.local/bin/config-symlinks +++ b/.local/bin/config-symlinks @@ -1,6 +1,8 @@ #!/bin/bash -sed -e '/^\s*$/d' -e '/#/d' symlinks | while read _target _link; do +declare -i ret=0 + +while read _target _link; do target="$(sed -rn 's|[^/]+/|../|g;s|/[^/]+$|/|p' <<<"$_link")${_target}" link="$HOME/$_link" if [[ -L "$link" ]]; then @@ -8,8 +10,11 @@ sed -e '/^\s*$/d' -e '/#/d' symlinks | while read _target _link; do fi if [[ -e "$link" ]]; then echo "ERROR: file exists: $link" >> /dev/stderr + ret=1 else mkdir -p "${link%/*}" ln -s "$target" "$link" fi -done +done < <(sed -e '/^\s*$/d' -e '/#/d' "$XDG_CONFIG_HOME/symlinks") + +exit $ret -- cgit v1.2.3-54-g00ecf