NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: where is device manufacturer/model kept?



You wrote:
> 
>     Date:        Mon, 28 Jun 2021 12:18:50 +0000 (UTC)
>     From:        RVP <rvp%SDF.ORG@localhost>
>     Message-ID:  <556bb7f-3792-635e-86ed-6d7c6b752b3c%SDF.ORG@localhost>
> 
>   | echo $(sysctl -n machdep.dmi.system-vendor)
> 
> That's a convoluted way of writing
> 	sysctl -n machdep.dmi.system-vendor
> and one which could fail if the string just happened to contain
> the "wrong" characters (depending upon which version of echo is
> being used for which are "wrong" for this purpose).
> 
> kre
> 

FWIW this is what I put in my (Tcl) script:

set vendorprod [split [exec  /sbin/sysctl -n machdep.dmi.system-vendor \
machdep.dmi.system-product machdep.dmi.system-version] "\n"]

It turns out that different machines may have either of the last two
blank but not empty, with the product's name arbitrarily in one position or
the other.

--
Steve Blinkhorn <steve%blinkhorn.com@localhost>


Home | Main Index | Thread Index | Old Index