From 0d94dfd8d7c24b1eb18a468bf72aee69558fc226 Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Thu, 20 Aug 2020 13:08:19 -0500 Subject: [PATCH] Truncate using parameter expansion I'm not completely sure truncation is actually needed, but regardless this removes the dependency on `cut`. --- yadm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yadm b/yadm index f5ad123..e856acd 100755 --- a/yadm +++ b/yadm @@ -1944,8 +1944,8 @@ function get_mode { mode=$(stat -c '%a' "$filename" 2>/dev/null) if [ -z "$mode" ] ; then # BSD-style - # Using the `cut` command to match the output of GNU stat output - mode=$(stat -f '%p' "$filename" | cut -c4-6 2>/dev/null) + mode=$(stat -f '%p' "$filename" 2>/dev/null) + mode=${mode: -4} fi # only accept results if they are octal