mirror of
https://github.com/TheLocehiliosan/yadm
synced 2024-10-27 20:34:27 +00:00
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
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 New Issue
Block a user