diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-11-13 09:38:29 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-11-13 09:38:29 -0700 |
commit | 2889dbb40b5891309861d79d20e16288d7fa12a9 (patch) | |
tree | 88642ab9a40312de2e262e4537272f282189acd9 /bin/hstow | |
parent | f223f38fcab3c94402603d1fadb2d6fa0ac3d05a (diff) | |
download | dotfiles-2889dbb40b5891309861d79d20e16288d7fa12a9.tar.gz |
hstow: use correct option to wc(1) for counting characters not bytes
Diffstat (limited to 'bin/hstow')
-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 / _)" |