[HPADM] Script question

From: Sweetser, Joe P. - PW Fleet (Joseph.Sweetser@ci.denver.co.us)
Date: Fri May 21 2004 - 12:04:10 EDT


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)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:41 EDT