lsblk odd results

Ralf Mardorf silver.bullet at zoho.com
Fri Feb 22 08:35:11 UTC 2019


On Fri, 2019-02-22 at 08:11 +0000, Grizzly wrote:
> 22 February 2019  at 8:32, Ralf Mardorf wrote:
> > the output is correct, your reasoning isn't.
> > 0 = true  or right
> > 1 = false or wrong
> 
> your own results confirm what I said
> 
> Your SSD's return 0 & your DVD returns 1
> 
> So by your reasoning you would have 4 rotational devices and a non rotational 
> DVD ?

Oops, you are right. However, the output is still correct, my reasoning
wasn't.

$ lsblk --help | grep ROTA
        ROTA  rotational device

IOW this option does check if a device is a spinning or if it is not a
spinning device.

Actually the guess

0 is for "YES, it is a spinning device"
         "it is TRUE, it is a spinning devcie"
         "RIGHT, the device is a spinning device"

1 is for "NO, it is   n o t   a spinning device"
         "it is FALSE, it is   n o t   a spinning device"
         "WRONG, the device is   n o t   a spinning device"

IOW the guess 1 always denies, is my mistake in the early morning ;).

If we think of an error exit status in a bash scrip,

0 = zero error

anything else = an error or errors, makes sense.

If we think of logic and programming languages, then

0 = OFF
1 = ON

0 = FALSE
1 = TRUE

makes more sense.

"C, C++, Objective-C, AWK
Initial implementations of the language C (1972) provided no Boolean
type, and to this day Boolean values are commonly represented by
integers (ints) in C programs. The comparison operators (>, ==, etc.)
are defined to return a signed integer (int) result, either 0 (for
false) or 1 (for true). Logical operators (&&, ||, !, etc.) and
condition-testing statements (if, while) assume that zero is false and
all other values are true." - 
https://en.wikipedia.org/wiki/Boolean_data_type

Regards,
Ralf






More information about the ubuntu-users mailing list