Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #204244 > unrolled thread

re: taming lsblk command

Started byJude DaShiell <jdashiel@panix.com>
First post2019-01-09 16:10 +0100
Last post2019-01-09 16:50 +0100
Articles 6 — 4 participants

Back to article view | Back to linux.debian.user


Contents

  re: taming lsblk command Jude DaShiell <jdashiel@panix.com> - 2019-01-09 16:10 +0100
    Re: taming lsblk command Jochen Spieker <ml@well-adjusted.de> - 2019-01-09 16:20 +0100
      Re: taming lsblk command Jude DaShiell <jdashiel@panix.com> - 2019-01-09 16:30 +0100
      Re: taming lsblk command Jude DaShiell <jdashiel@panix.com> - 2019-01-09 16:40 +0100
        Re: taming lsblk command Greg Wooledge <wooledg@eeg.ccf.org> - 2019-01-09 16:40 +0100
        Re: taming lsblk command <tomas@tuxteam.de> - 2019-01-09 16:50 +0100

#204244 — re: taming lsblk command

FromJude DaShiell <jdashiel@panix.com>
Date2019-01-09 16:10 +0100
Subjectre: taming lsblk command
Message-ID<xenEu-3LN-19@gated-at.bofh.it>
what works over here:
lsblk -n < /usr/bin/sort


-- 

[toc] | [next] | [standalone]


#204245

FromJochen Spieker <ml@well-adjusted.de>
Date2019-01-09 16:20 +0100
Message-ID<xenOa-3Pg-7@gated-at.bofh.it>
In reply to#204244

[Multipart message — attachments visible in raw view] — view raw

Jude DaShiell:
> what works over here:
> lsblk -n < /usr/bin/sort

This command feeds the content of the file /usr/bin/sort into stdin of
lsblk. That does not make sense and I guess lsblk is just ignoring this
input.

J.
-- 
I enjoy shopping, eating, sex and doing jigsaw puzzles of idealised
landscapes.
[Agree]   [Disagree]
                 <http://archive.slowlydownward.com/NODATA/data_enter2.html>

[toc] | [prev] | [next] | [standalone]


#204246

FromJude DaShiell <jdashiel@panix.com>
Date2019-01-09 16:30 +0100
Message-ID<xenXP-3SA-3@gated-at.bofh.it>
In reply to#204245
It would if you had entered it backward.  Now I'm going to have to do a
typescript for you.
On Wed, 9 Jan 2019, Jochen Spieker wrote:

> Date: Wed, 9 Jan 2019 10:17:50
> From: Jochen Spieker <ml@well-adjusted.de>
> To: debian-user@lists.debian.org
> Subject: Re: taming lsblk command
>
> Jude DaShiell:
> > what works over here:
> > lsblk -n < /usr/bin/sort
>
> This command feeds the content of the file /usr/bin/sort into stdin of
> lsblk. That does not make sense and I guess lsblk is just ignoring this
> input.
>
> J.
>

-- 

[toc] | [prev] | [next] | [standalone]


#204248

FromJude DaShiell <jdashiel@panix.com>
Date2019-01-09 16:40 +0100
Message-ID<xeo7w-3VN-31@gated-at.bofh.it>
In reply to#204245
On Wed, 9 Jan 2019, Jochen Spieker wrote:

> Date: Wed, 9 Jan 2019 10:17:50
> From: Jochen Spieker <ml@well-adjusted.de>
> To: debian-user@lists.debian.org
> Subject: Re: taming lsblk command
>
> Jude DaShiell:
> > what works over here:
> > lsblk -n < /usr/bin/sort
>
> This command feeds the content of the file /usr/bin/sort into stdin of
> lsblk. That does not make sense and I guess lsblk is just ignoring this
> input.
>
> J.
>
Script started on Wed 09 Jan 2019 10:30:00 AM EST
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
jude[~]$ exit
exit

Script done on Wed 09 Jan 2019 10:30:50 AM EST
-- 

[toc] | [prev] | [next] | [standalone]


#204249

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2019-01-09 16:40 +0100
Message-ID<xeo7w-3VN-33@gated-at.bofh.it>
In reply to#204248
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.

[toc] | [prev] | [next] | [standalone]


#204250

From<tomas@tuxteam.de>
Date2019-01-09 16:50 +0100
Message-ID<xeohc-3Zl-13@gated-at.bofh.it>
In reply to#204248

[Multipart message — attachments visible in raw view] — view raw

On Wed, Jan 09, 2019 at 10:31:46AM -0500, Jude DaShiell wrote:
> On Wed, 9 Jan 2019, Jochen Spieker wrote:
> 
> > Date: Wed, 9 Jan 2019 10:17:50
> > From: Jochen Spieker <ml@well-adjusted.de>
> > To: debian-user@lists.debian.org
> > Subject: Re: taming lsblk command
> >
> > Jude DaShiell:
> > > what works over here:
> > > lsblk -n < /usr/bin/sort
> >
> > This command feeds the content of the file /usr/bin/sort into stdin of
> > lsblk. That does not make sense and I guess lsblk is just ignoring this
> > input.
> >
> > J.
> >
> Script started on Wed 09 Jan 2019 10:30:00 AM EST
> 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
> jude[~]$ exit
> exit
> 
> Script done on Wed 09 Jan 2019 10:30:50 AM EST

Still, I agree with Jochen here.

Lsblk just ignores its standard input (lucky you! -- who knows what
lurking bugs this unexpected input might tickle!). Your command
would do just the same without the < /usr/bin/sort.

With

  lsblk -n < /usr/bin/sort

you are feeding the contents of the /usr/bin/sort binary program to
lsblk's standard input.

Rather do:

  lsblk <options> | /usr/bin/sort <options>

or, typically:

  lsblk <options> | sort <options>

since /usr/bin *is* in your PATH (is it not? Complain to your sysadmin)
or (attention, bashism ahead!):

  sort <(lsblk)

(whitespaces matter here!), which will only work if your shell is bash,
but is the next resemblance to your command line above I could come
up with.

Cheers
-- tomás

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web