Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site mtuni.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!whuxl!whuxlm!akgua!akguc!mtunh!mtuni!chip From: chip@mtuni.UUCP (Charles Maurer) Newsgroups: net.unix Subject: redirecting stdin in ksh Message-ID: <235@mtuni.UUCP> Date: Fri, 17-Jan-86 14:39:17 EST Article-I.D.: mtuni.235 Posted: Fri Jan 17 14:39:17 1986 Date-Received: Sun, 19-Jan-86 05:10:29 EST Distribution: net Organization: AT&T ISL Holmdel NJ USA Lines: 29 While creating a shell script using ksh, I attempted to redirect stdin for a series of reads from a file (See "The Unix System" by S. Bourne, pg 212). The code goes as follows: more="yes" exec 3<&0 < file # dup stdin to fd 3, and redirect from file while [ "$more" ] do read number age name if [ "$?" -eq 0 ] then process number, age, name else # end of file more="" fi done exec 0<&3 3<&- # redirect stdin back to fd 0, close fd 3 The input is redirected fine, but the script never regains control from normal stdin. When I "sh" the file, it works as it should. What should be done to achieve the same effect through ksh? I don't need to know alternative ways of accomplishing the same thing. Thanks in advance, chip maurer mtuni!chip