Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site pegasus.UUCP Path: utzoo!linus!security!genrad!grkermit!masscomp!clyde!ihnp4!houxm!hogpc!pegasus!guidi From: guidi@pegasus.UUCP Newsgroups: net.unix Subject: Re: 'c' shell scripts Message-ID: <828@pegasus.UUCP> Date: Wed, 14-Dec-83 10:14:53 EST Article-I.D.: pegasus.828 Posted: Wed Dec 14 10:14:53 1983 Date-Received: Fri, 16-Dec-83 02:14:04 EST References: <14504@sri-arpa.UUCP> Organization: AT&T Information Systems, Lincroft NJ Lines: 15 How to read lines from a file and then go back to standard input inside a shell script? I use the following MODEL (Bourne Shell) which may give some inkling on how to do it with other shells: tty=`tty` # where std in is exec < a-file # the file I want to read read line # read a line from the file while [ "$?" = 0 ] # until error return (EOF) from "read" do echo $line # process what I read from file read line # get the next line (if any) done exec < $tty # change std in to something else echo "terminal input?\c" # etc..... read line echo $line