zfs_snapshot_cron.sh: fix bash leading 0 bug

This commit is contained in:
Alice Gaudon 2020-04-07 00:11:38 +02:00
parent 0584914cc2
commit db99afeb19
1 changed files with 3 additions and 3 deletions

View File

@ -39,13 +39,13 @@ handle_pool() {
if [ $D -gt 0 ]; then
D=$(( D-1 ))
echo "KEEP; D: $D"
elif [ $W -gt 0 ] && [ ${scomp[3]} -eq 1 ]; then
elif [ $W -gt 0 ] && [ ${scomp[3]#0} -eq 1 ]; then
W=$(( W-1 ))
echo "KEEP; W: $W"
elif [ $M -gt 0 ] && [ ${scomp[3]} -eq 1 ] && [ $(( scomp[4] % 4 )) -eq 0 ]; then
elif [ $M -gt 0 ] && [ ${scomp[3]#0} -eq 1 ] && [ $(( ${scomp[4]#0} % 4 )) -eq 0 ]; then
M=$(( M-1 ))
echo "KEEP; M: $M"
elif [ $Y -gt 0 ] && [ ${scomp[3]} -eq 1 ] && [ ${scomp[4]} -eq 4 ]; then
elif [ $Y -gt 0 ] && [ ${scomp[3]#0} -eq 1 ] && [ ${scomp[4]#0} -eq 4 ]; then
Y=$(( Y-1 ))
echo "KEEP; Y: $Y"
else