21 lines
328 B
Text
21 lines
328 B
Text
|
#!/bin/bash
|
||
|
# script-friendly df
|
||
|
|
||
|
factor=1024 # default
|
||
|
|
||
|
OPTSTRING="H"
|
||
|
while getopts ${OPTSTRING} opt; do
|
||
|
case ${opt} in
|
||
|
H)
|
||
|
factor=1000
|
||
|
;;
|
||
|
esac
|
||
|
done
|
||
|
shift $((OPTIND-1))
|
||
|
|
||
|
target=${1:-.}
|
||
|
|
||
|
free_bytes=$(findmnt --df -T "$target" -oAVAIL --bytes | sed '1d')
|
||
|
free_gigs=$((free_bytes/(factor**3)))
|
||
|
echo $free_gigs
|