Re: why is my local user (/dev/sda5) drive not being displayed by df?
On Wed, Mar 11, 2020 at 01:21:17PM +0100, tomas@tuxteam.de wrote:
> On Wed, Mar 11, 2020 at 01:02:59PM +0100, Albretch Mueller wrote:
> > with your help I found a way around it (here is my silly scripting):
> >
> > $ sudo _DF=$(df -h)
>
> I don't think you need "sudo" for "df"?
And a good thing, too, because that syntax is completely wrong.
wooledg:~$ sudo x=$(id)
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
[command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-T timeout] [-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-T timeout] [-u user] file ...
wooledg:~$ sudo x=$(df -h)
[sudo] password for wooledg:
sudo: Size: command not found
I think what Albretch was *trying* to do was this:
_DF=$(sudo df -h)
which would work, but as Tomas said, the sudo is just not needed.
P.S. see <https://mywiki.wooledge.org/BashFAQ/094> for more information
on parsing df output, in general.
Reply to: