Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!ucbvax!VM.UOGUELPH.CA!LEONARDZ From: LEONARDZ@VM.UOGUELPH.CA (Len Zaifman) Newsgroups: comp.sys.sgi Subject: Re: mt status option Message-ID: <9012121836.aa16091@VGR.BRL.MIL> Date: 12 Dec 90 23:31:25 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 51 On Tue, 11 Dec 90 14:52:27 EST you said: >Hi everyone, > I'm trying to write a shell script in which I need to find >out if the 8mm tape is in the drive. Whenever I execute the >mt command with the status option, the output always appears at >my terminal, regardless of whether its output is redirected or piped, >or even if it's in a shell script on the right side of an equal sign. >Does anyone know how this output can be redirected so that I can >capture the 'status' information? I tried > > mt -t /dev/mt/tps0d6 status > dum > > mt -t /dev/mt/tps0d6 status | grep Status > > and in a shell script: > > xxx=`mt -t /dev/mt/tps0d6 status` > >All of the above display the output at my terminal. Thanks >in advance. In csh use >& to redirect the stderr output to a file : See example below : < 24 nic.uoguelph.ca /cs/leonardz> mt -t /dev/nrxb status Controller: SCSI | This Device: EXABYTE: EXB-8200 425A | appears Status: 0x200 | on Media : Not READY | terminal < 25 nic.uoguelph.ca /cs/leonardz> mt -t /dev/nrxb status >& mystat < 26 nic.uoguelph.ca /cs/leonardz> cat mystat Controller: SCSI Device: EXABYTE: EXB-8200 425A Status: 0x200 Media : Not READY < 27 nic.uoguelph.ca /cs/leonardz> > >kcables@relay.nswc.navy.mil Regards, Len Zaifman Len Zaifman Information Technology Coordinator,College of Physical and Engineering Science Department of Computing Services University of Guelph Guelph,Ontario. N1G 2W1 (519)821-4120 xt 6566 email : LeonardZ@VM.UOGUELPH.CA