diff options
author | Luke Shumaker <shumakl@purdue.edu> | 2014-04-21 11:57:28 -0400 |
---|---|---|
committer | Luke Shumaker <shumakl@purdue.edu> | 2014-04-21 11:57:28 -0400 |
commit | 872ada38529cca7f190767d4fba7450a1ebff857 (patch) | |
tree | 09493259345bf8bcaf0a2a61ab4e14946e0002da /.local/bin | |
parent | f4453acbfdb1ac77a8bffc05635daf7aa3fee605 (diff) |
make the config-symlinks script report errors
Diffstat (limited to '.local/bin')
-rwxr-xr-x | .local/bin/config-symlinks | 9 |
1 files 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 |