2.8 Bourne shell question

Rob Warnock rpw3 at redwood.UUCP
Fri Sep 13 06:47:30 AEST 1985


+---------------
| > I tried this litle shell script on my 2.8BSD Bourne shell:
| > 	read word < foo
| > and it didn't do what I thought it would do...
| > Is it possible to read from files?  Is this just a 2.8 bug?
| It's a defect in old Bourne shells... recent (SysV) shells have fixed this.
| Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry
+---------------

Another "quick hack" I have seen for this is:

	word=`head foo`

If you don't have "head", you can write it easily enough, or use (*gag*):

	word=`(read junk; echo \$junk) < foo`


Rob Warnock
Systems Architecture Consultant

UUCP:	{ihnp4,ucbvax!dual}!fortune!redwood!rpw3
DDD:	(415)572-2607
USPS:	510 Trinidad Lane, Foster City, CA  94404



More information about the Comp.unix mailing list