On 2/3/23 20:58, Gunnar Lindholm wrote:
> +With the @option{-b} and @option{-f} options one can use the exit status to
> +verify the available space (in bytes or percentage) with a command like
> +@samp{if df -b 640000 /var/log ; then echo "That is big enough for
everyone"; fi}
Thanks for the patch as a basis for discussion. That's an interesting use-case.
However, I'm 20:80 to add it - for the following reasons:
a) The functionality can easily be achieved via scripting, e.g. using the
--output option
and sed(1):
$ df --output=pcent /
Use%
83%
$ if test 80 -gt `df --output=pcent / | sed '1d;s/%//'`; then echo FINE; else
echo TOO_FULL; fi
TOO_FULL
$ if test 85 -gt `df --output=pcent / | sed '1d;s/%//'`; then echo FINE; else
echo TOO_FULL; fi
FINE
b) The new code adds quite some extra complexity, but still stands in
contradiction to
most of the other options. So it does not "feel right" in there.
Have a nice day,
Berny