From owner-freebsd-questions Sat Aug 30 22:22:14 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id WAA20424 for questions-outgoing; Sat, 30 Aug 1997 22:22:14 -0700 (PDT) Received: from gdi.uoregon.edu (cisco-ts6-line3.uoregon.edu [128.223.150.33]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id WAA20419 for ; Sat, 30 Aug 1997 22:22:11 -0700 (PDT) Received: from localhost (dwhite@localhost) by gdi.uoregon.edu (8.8.5/8.8.5) with SMTP id WAA00799; Sat, 30 Aug 1997 22:22:04 -0700 (PDT) Date: Sat, 30 Aug 1997 22:22:04 -0700 (PDT) From: Doug White X-Sender: dwhite@localhost Reply-To: Doug White To: Zach Heilig cc: questions@FreeBSD.ORG Subject: Re: Is that floppy write-protected? In-Reply-To: <19970828085510.60034@gaffaneys.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Thu, 28 Aug 1997, Zach Heilig wrote: > Is it possible to determine if a floppy disk is write-protected from a script? > If you happen to be staring at the console, it's pretty obvious for a person > to determine what is happening, but I can't figure out how to tell from a > script. > > If you mount a write-protected flopp, and remove a file on it, the script > can't tell if the file was really removed or not (it sure looks like it was > removed from the scripts point of view). Check the return value from `rm'; if it's >0 then something bad happened. > I know I could unmount the floppy, remount it, and test if the files are > really gone, but then /var/log/messages becomes full of needless > write-protected floppy errors. This is what I ended up doing, but it > would be nice if there were a better solution. How about re-read the directory following the `rm'? If rm trashed the file then the dir re-read should show it's gone. Doug White | University of Oregon Internet: dwhite@resnet.uoregon.edu | Residence Networking Assistant http://gladstone.uoregon.edu/~dwhite | Computer Science Major Spam routed to /dev/null by Procmail | Death to Cyberpromo