Web lists-archives.com

Re: taming lsblk command




On Wed, Jan 09, 2019 at 10:31:46AM -0500, Jude DaShiell wrote:
> jude[~]$ lsblk -n < /usr/bin/sort
> sda      8:0    0 111.8G  0 disk
> ??????sda1   8:1    0 111.8G  0 part /
> ??????sda2   8:2    0  32.5M  0 part [SWAP]
> sdb      8:16   0  55.9G  0 disk
> ??????sdb1   8:17   0    55G  0 part
> sr0     11:0    1  1024M  0 rom

root@wooledg:/home/wooledg# lsblk -n </dev/null
sda      8:0    0 238.5G  0 disk
├─sda1   8:1    0   300M  0 part
├─sda2   8:2    0  46.6G  0 part
├─sda3   8:3    0   2.8G  0 part /boot
├─sda4   8:4    0     1K  0 part
├─sda5   8:5    0   7.5G  0 part [SWAP]
└─sda6   8:6    0 181.4G  0 part /
sr0     11:0    1  1024M  0 rom
root@wooledg:/home/wooledg# lsblk -n </bin/dash
sda      8:0    0 238.5G  0 disk
├─sda1   8:1    0   300M  0 part
├─sda2   8:2    0  46.6G  0 part
├─sda3   8:3    0   2.8G  0 part /boot
├─sda4   8:4    0     1K  0 part
├─sda5   8:5    0   7.5G  0 part [SWAP]
└─sda6   8:6    0 181.4G  0 part /
sr0     11:0    1  1024M  0 rom

Redirecting stdin from /usr/bin/sort only "works" because lsblk doesn't
actually read stdin at all.  It is a preposterously silly thing to do.