Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!math.fu-berlin.de!unidui!unido!majestix!wib From: wib@informatik.uni-kiel.dbp.de (Willi Burmeister) Newsgroups: comp.unix.shell Subject: problems with 'while read' Message-ID: <3635@dagobert.informatik.uni-kiel.dbp.de> Date: 6 May 91 16:14:52 GMT Organization: Universitaet Kiel, Germany Lines: 53 Just a simple (??) question: Why does this small program not work? ------ cut here ------ cut here ------ cut here ------ cut here ------ #!/bin/sh # cat << EOF > hugo one two three four EOF while read num do echo "do something with <$num>" last=$num done < hugo echo "last num = <$last>" ------ cut here ------ cut here ------ cut here ------ cut here ------ the output will always be: do something with do something with do something with do something with last num = <> What I want is: do something with do something with do something with do something with last num = ^^^^ Any help would be much appreciated. thanks in advance Willi +------------------+----------------------------------------+ | Willi Burmeister | e-mail: wib@informatik.uni-kiel.dbp.de | | Holzkrugweg 30 | phone office: +49 0431 560498 | | D-2390 Flensburg | phone home: +49 0461 94166 | +------------------+----------------------------------------+