Open fortran77 opened 5 years ago
I don't see this on my CentOS 7 system. Can you post exactly what the df
command outputs for you?
Here's some information, empty lines added for readability, and a hostname redacted. This is a CentOS 7 server instance at upcloud.com. Also cmp /bin/df /usr/bin/df
shows that they are identical.
bash-4.2# df /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 26203136K 7074856K 19128280K 28% /
bash-4.2# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 26203136K 7074904K 19128232K 28% /
devtmpfs 496728K 0K 496728K 0% /dev
tmpfs 507444K 0K 507444K 0% /dev/shm
tmpfs 507444K 25936K 481508K 6% /run
tmpfs 507444K 0K 507444K 0% /sys/fs/cgroup
tmpfs 101492K 0K 101492K 0% /run/user/0
bash-4.2# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
bash-4.2# which df
/bin/df
bash-4.2# alias df
bash: alias: df: not found
bash-4.2# uname -a
Linux (HOSTNAME REDACTED) 3.10.0-957.10.1.el7.x86_64 #1 SMP Mon Mar 18 15:06:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
By the way, df -P
with the portability option will print the integers without the K suffix. However -P
might not be available in older systems, so that makes it non-portable.
In the following code at around line 634
on some systems (e.g., newer CentOS 7) the
df
command may print a filesystem size with a 'K' suffix. On the next line, the 'if [ "$root_fs_avail" -lt ...] ...' then reports an error because '-lt' expects a numeric argument.An easy fix would be to pipe df's output through
sed -e 's/[^0-9]//g'
thus deletng all non-numeric characters.