summaryrefslogtreecommitdiff
path: root/bin/hstow
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-11-13 09:38:29 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-11-13 09:38:29 -0700
commit2889dbb40b5891309861d79d20e16288d7fa12a9 (patch)
tree88642ab9a40312de2e262e4537272f282189acd9 /bin/hstow
parentf223f38fcab3c94402603d1fadb2d6fa0ac3d05a (diff)
downloaddotfiles-2889dbb40b5891309861d79d20e16288d7fa12a9.tar.gz
hstow: use correct option to wc(1) for counting characters not bytes
Diffstat (limited to 'bin/hstow')
-rwxr-xr-xbin/hstow6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/hstow b/bin/hstow
index d151504b..f05f0aaf 100755
--- a/bin/hstow
+++ b/bin/hstow
@@ -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 / _)"