[HPADM] Script question

From: Sweetser, Joe P. - PW Fleet (Joseph.Sweetser_at_ci.denver.co.us)
Date: 05/21/04

  • Next message: Sweetser, Joe P. - PW Fleet: "[HPADM] RE: Script question"
    Date: Fri, 21 May 2004 10:04:10 -0600
    To: <hpux-admin@dutchworks.nl>
    
    

    This should be simple, but my head is starting to hurt from hitting
    against the wall.

    I have a script that reads input from a file in a while loop, labels
    tapes based on the data in the file, umounts the tape after labeling,
    and prompts the user to put in another tape. The problem is the read
    command inside the while loop reads from the file (STDIN, I guess) and I
    want it to read from the terminal. Is there a way to make read do this?
    Can I use a re-direct to force it to read from the command line?

    ADVthanksANCE,
    joe
    -----------------------------------------------
    echo "Enter filename: \c"
    read FILE

    LABEL=abc
    while test -n "$LABEL"
    do
       read LABEL
       echo "Labeling tape $LABEL..."
       bplabel -m $LABEL -d dlt -u 0

       if [ $? -eq 0 ]
       then
          # Unload the tape
          mt -t /dev/rmt/0m offline
          echo "Tape successfully labeled."
          echo ""
          echo "Insert next tape to be labeled and hit <CR> when ready...
    \c"
          read ANS ### THIS IS THE PROBLEM READ STMT ####
       else
          echo "Tape label for $LABEL failed!"
          echo "Exiting script."
          echo ""
          exit 1
       fi

    done < $FILE

    --
                 ---> Please post QUESTIONS and SUMMARIES only!! <---
            To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
           Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
     
     Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
                http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)
    

  • Next message: Sweetser, Joe P. - PW Fleet: "[HPADM] RE: Script question"

    Relevant Pages

    • Re: despair
      ... %SYSTEM-F-DEVMOUNT, device is already mounted ... It's a command procedure and should be written ... I'm talking about "someone left the wrong tape in" or "someone else is ... You allocate a resource, you ...
      (comp.os.vms)
    • RE: NTBackup - any resources
      ... Ejecting the tape can''t be done using the backup utility; ... removable storage manager that controls the tape and it can eject it: ... It can also be done from a command line. ... What I would suggest is to create a batch file that includes the backup ...
      (microsoft.public.windows.server.sbs)
    • Re: tape command for solaris 8
      ... >> Well to answer number one, how do you want to write to tape? ... > I do not want the tape to rewind after you write to it. ... # setenv each of these variables if the corresponding filesystem ...
      (comp.unix.solaris)
    • Re: tape command for solaris 8
      ... >> Well to answer number one, how do you want to write to tape? ... > I do not want the tape to rewind after you write to it. ... # setenv each of these variables if the corresponding filesystem ...
      (comp.sys.sun.admin)
    • Tape i/o and scsi pass through
      ... I previously posted about a problem getting EOT warnings on DLT. ... function whose purpose is to execute this command in the windows environment. ... sometimes assert things like tape density, for which there is apparently no Windows API. ...
      (microsoft.public.win32.programmer.kernel)