coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] df: new options


From: Bernhard Voelker
Subject: Re: [PATCH] df: new options
Date: Fri, 10 Feb 2023 23:09:13 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]