Skip to content

bad space left evaluation

Hi, the "core/procedures/interactive" file had a miss evaluation of the space left, df provide the space used, not the space free, then the evaluation must be "-gt" 90

  else
    space_used="$(df --output=pcent / | tail -1 | grep -oE '[0-9]+')"
    if [[ $space_used -gt 90 ]] ; then
      notify "Your main drive has less than 10% free space left"
    fi
  fi
}

Another approach is use awk to get the free space, for example:

df -h | awk 'NR==1{print "Free Space"} NR>1{used=substr($5, 1, length($5)-1); free=100-used; print free"%"}'

I comment the same in the OS github repo https://github.com/substring/os/issues/48

Regards.

Edited by dubcl