Subject: bug in sh?
To: None <current-users@NetBSD.ORG>
From: Jon Buller <jonb@alfred.ons.octel.com>
List: current-users
Date: 05/25/1995 08:47:16
Could someone tell me if this is proper behavior for sh, a known bug,
or a newly discovered critter?  the shell was suped just a few days ago,
rebuilt and installed.  Anyway, here is what happened:

jonb@bullbox[4]% cat data
key1 k1data1 k1data2 k1data3
key2 k2data1 k2data2 k2data3
jonb@bullbox[5]% cat prog1
#!/bin/sh -

grep "^$1" ./data | read key data1 data2 data3
echo $key - $data1 - $data2 - $data3

exit 0
jonb@bullbox[6]% ./prog1 key1
- - -
jonb@bullbox[7]% cat prog2
#!/bin/sh -

grep "^$1" ./data | while read key data1 data2 data3
do
   echo $key - $data1 - $data2 - $data3
done

exit 0
jonb@bullbox[8]% ./prog2 key1
key1 - k1data1 - k1data2 - k1data3
jonb@bullbox[9]% 


Notice that the read command does not appear to want to do anything
unless it has a loop to work in.  I went through my POSIX.2 spec,
and nothing jumped out at me WRT the read command doing something
like this.  Any suggestions?

Jon