Truncate using parameter expansion
I'm not completely sure truncation is actually needed, but regardless this removes the dependency on `cut`.
This commit is contained in:
parent
b45aba385e
commit
0d94dfd8d7
1 changed files with 2 additions and 2 deletions
4
yadm
4
yadm
|
@ -1944,8 +1944,8 @@ function get_mode {
|
||||||
mode=$(stat -c '%a' "$filename" 2>/dev/null)
|
mode=$(stat -c '%a' "$filename" 2>/dev/null)
|
||||||
if [ -z "$mode" ] ; then
|
if [ -z "$mode" ] ; then
|
||||||
# BSD-style
|
# BSD-style
|
||||||
# Using the `cut` command to match the output of GNU stat output
|
mode=$(stat -f '%p' "$filename" 2>/dev/null)
|
||||||
mode=$(stat -f '%p' "$filename" | cut -c4-6 2>/dev/null)
|
mode=${mode: -4}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# only accept results if they are octal
|
# only accept results if they are octal
|
||||||
|
|
Loading…
Reference in a new issue