[LTP] [PATCH v2 1/1] ver_linux: Print filesystems

Petr Vorel pvorel@suse.cz
Wed Nov 3 17:10:58 CET 2021


> Hi!
> > Ah, sorry, I see why I checked it more complicated way:
> > with simply checking exit code you have output twice:

> > df -hT 2>/dev/null || df
> > Filesystem                     Type      Size  Used Avail Use% Mounted on
> > devtmpfs                       devtmpfs   16G  8,0K   16G   1% /dev
> > tmpfs                          tmpfs      16G   91M   16G   1% /dev/shm
> > tmpfs                          tmpfs     6,2G  4,1M  6,2G   1% /run
> > ...
> > df: /run/user/1000/doc: Operation not permitted
> > Filesystem                     Type      Size  Used Avail Use% Mounted on
> > devtmpfs                       devtmpfs   16G  8,0K   16G   1% /dev
> > tmpfs                          tmpfs      16G   91M   16G   1% /dev/shm
> > tmpfs                          tmpfs     6,2G  4,1M  6,2G   1% /run
> > ...

> > => which is IMHO nogo. I could redirect to a file and cut it after, but in that
> > case v2 is IMHO much better.

> But still we don't need that grep part, right?

> So it should be something as:

> 	if `df -hT 2>/dev/null >/dev/null`; then
> 		df -hT
> 	else
> 		df
> 	fi

Yep, how simple, thanks!

Kind regards,
Petr


More information about the ltp mailing list