Skip to content

Commit

Permalink
Fix call to stat
Browse files Browse the repository at this point in the history
From Stack Overflow:

GNU stat has -c, BSD stat has -f
stat is not in POSIX at all
  • Loading branch information
paulo-ferraz-oliveira committed Oct 21, 2023
1 parent d63e4f0 commit 38686f3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions kerl
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,8 @@ is_older_than_x_days() {
# $1: file to check
# $2: age in days

eval "$(\stat -s "$1")"
# shellcheck disable=SC2154 # .. is referenced but not assigned.
if [ $(($(date +%s) - st_mtime)) -gt $(($2 * 24 * 3600)) ]; then
kerl_st_mtime=$(\stat -c %X "$1")
if [ $(($(date +%s) - kerl_st_mtime)) -gt $(($2 * 24 * 3600)) ]; then
return 0
else
return 1
Expand Down

0 comments on commit 38686f3

Please sign in to comment.