Subject: Re: testing presence of a device (was sun-lamp CVS commits)
To: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
From: Rolf Grossmann <>
List: current-users
Date: 10/05/1995 02:26:16

on Wed, 4 Oct 1995 16:20:10 -0400 der Mouse wrote 
concerning "Re: sun-lamp CVS commits" something like this:

>> I think, if you want to test the presence of a device, you should try
>> to open it for reading.  If you succeed, the device is present.
> Yes...but if you fail, that does not necessarily mean the device is
> absent.  It could mean it isn't powered on, it could mean it has no
> media in it, it could mean anything the driver wants it to mean.

... which in most cases has the effect of telling me that it's not useable
to install NetBSD on it, which was what it we wanted to know in the first
place. I admit I was generalizing too much ;)

> On a NetBSD/sparc machine with a bwtw0 but only one disk (sd0),
> [Callisto] 15> sh -c 'if ( < /dev/sd2a ) 2> /dev/null; then echo yes; else echo no; fi'
> no
> [Callisto] 16> sh -c 'if ( < /dev/bwtwo0 ) 2> /dev/null; then echo yes; else echo no; fi'
> yes
> [Callisto] 17>

> Looks like just what the doctor ordered.

Hmmm ... looks like I should stick to the kernel and forget about shell
programming ;) I had tried some things and didn't succeed.

So, maybe this is another step towards portable installation scripts?

Bye, Rolf