Adjust file mode check for BSD based systems
Adjusts the file mode check for BSD based systems as default BSD stat uses "-f '%p'" to report the file mode. Also since `stat -p '%p' "$filename"` reports more information than just read, write, execute perms, pipe the output through `cut` to grab only the last three digits. Signed-off-by: Adam Jimerson <vendion@gmail.com>
This commit is contained in:
parent
7628a1b61d
commit
a13311feac
1 changed files with 2 additions and 1 deletions
3
yadm
3
yadm
|
@ -1944,7 +1944,8 @@ function get_mode {
|
|||
mode=$(stat -c '%a' "$filename" 2>/dev/null)
|
||||
if [ -z "$mode" ] ; then
|
||||
# BSD-style
|
||||
mode=$(stat -f '%A' "$filename" 2>/dev/null)
|
||||
# Using the `cut` command to match the output of GNU stat output
|
||||
mode=$(stat -f '%p' "$filename" | cut -c4-6 2>/dev/null)
|
||||
fi
|
||||
|
||||
# only accept results if they are octal
|
||||
|
|
Loading…
Reference in a new issue