You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
519 B

#!/bin/bash
[ -z $1 ] && index=0 || index=$1
disks=('/dev/sda1' '/dev/sda15')
[ ${#index} -gt 1 ] && disks=("$index") && index=0
_df=`df -h | tr -s [:blank:] | egrep "^${disks[${index}]} "`
disk=`echo $_df | cut -d' ' -f1` # /dev/sda1
size=`echo $_df | cut -d' ' -f2` # 20G
used=`echo $_df | cut -d' ' -f3` # 16G
left=`echo $_df | cut -d' ' -f4` # 6.1G
perc=`echo $_df | cut -d' ' -f5` # 69%
mntp=`echo $_df | cut -d' ' -f6` # /
rper=`echo $perc | tr -d "%"` # 69
echo "Disk: $disk"
echo "Space: $used/$size"