diff options
-rwxr-xr-x | bin/hstow | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -40,7 +40,7 @@ if ! command -v readlink >/dev/null; then readlink () { # Safe parse of ls(1) output given its POSIX specification. ls -ld "$1" | tr -s ' ' \ - | cut -d' ' -f9- | cut -c$((4 + $(echo "$1" | wc -c)))- + | cut -d' ' -f9- | cut -c$((4 + $(echo "$1" | wc -m)))- } fi @@ -131,7 +131,7 @@ stow () { unstow () { cd "$HOME" - dir_pat="^.$(echo $DIR | cut -c$(echo $HOME | wc -c)-)/" + dir_pat="^.$(echo $DIR | cut -c$(echo $HOME | wc -m)-)/" for file in $(find . -type l ! -name . ! -name "$cchars" \ | grep -v "$dir_pat"); do if readlink "$file" | grep -Eq '^(\.\./)*\.STOW/'"$NAME/"; then @@ -158,7 +158,7 @@ unstow () { [ $# = 2 ] || usage [ -d "$2" ] || fail "$2 is not an existing directory" DIR="$(cd $2; pwd)" -[ "$(echo $DIR | cut -c-$(($(echo $HOME | wc -c) - 1)))" = "$HOME" ] \ +[ "$(echo $DIR | cut -c-$(($(echo $HOME | wc -m) - 1)))" = "$HOME" ] \ || fail "$DIR is not below $HOME" NAME="$(echo $DIR | tr / _)" |