Return to BSD News archive
Received: by minnie.vk1xwt.ampr.org with NNTP id AA6851 ; Fri, 15 Jan 93 10:37:15 EST Path: sserve!manuel.anu.edu.au!munnari.oz.au!sgiblab!swrinde!cs.utexas.edu!uunet!pipex!unipalm!uknet!cf-cm!myrddin.isl.cf.ac.uk!paul From: paul@isl.cf.ac.uk (Paul) Newsgroups: comp.unix.bsd Subject: Re: Differences with here documents Message-ID: <1993Jan15.233635.6000@cm.cf.ac.uk> Date: 15 Jan 93 23:36:34 GMT References: <1993Jan15.230023.5307@cm.cf.ac.uk> Sender: news@cm.cf.ac.uk (Network News System) Organization: Intelligent Systems Lab, ELSYM, Universiity of Wales, College of Cardiff. Lines: 97 In article <1993Jan15.230023.5307@cm.cf.ac.uk> paul@isl.cf.ac.uk (Paul) writes: >I came across some problems with a script that worked on ultrix but not >386bsd, it came down to differences in command expansion in here >documents. The test prog I used was > >cat <<EOF >$(CHNFILES) >EOF > >which on 386bsd would give the following error. > >CHNFILES: command not found > >After reading the manual page for ash and bash it seems this is what I >should expect since substituion occurs unless the word (EOF) is quoted. > >Ok, so I read the manual page on ultrix and it said the same thing, yet >substitution does not take place on ultrix. > >Since I didn't want substitution I quoted EOF i.e. > >cat <<\EOF >$(CHNFILES) >EOF > >and this did what I wanted. Does this mean that there's a bug with the >ultrix shell (also SUNOS behaves in the same way). > >The original script came as part of a package which is meant to install >on a variety of platforms so it therefore assumes that the above >redirection is actually incorrect on most platforms. > >What is correct POSIX behaviour? I've looked at this a bit more since the above isn't what I wanted after all. The problem is slightly more involved. This is a bit of the original script : ---------------------------------- cat > $config.mk <<EOF DOMFILES=$domfiles DOMBLDARGS=$dombldargs CHNFILES=$chnfiles CHNBLDARGS=$chnbldargs $config: $config-dom.m4 $config-chn.m4 $config-dom.m4: $(DOMFILES) $config.mk ../Dombuild -o $config-dom.m4 $(DOMBLDARGS) EOF ------------------------------------- what it builds on ultrix is: ------------------------------------- DOMFILES= isl.dom slave.top.dom DOMBLDARGS= isl.dom -top slave.top.dom CHNFILES= slave.top.chn isl-local.chn isl.chn CHNBLDARGS=-top slave.top.chn -local isl-local.chn -ether isl.chn isl: isl-dom.m4 isl-chn.m4 isl-dom.m4: $(DOMFILES) isl.mk ../Dombuild -o isl-dom.m4 $(DOMBLDARGS) -------------------------------------- but what it builds on 386bsd is: -------------------------------------- DOMFILES= isl.dom slave.top.dom DOMBLDARGS= isl.dom -top slave.top.dom CHNFILES= slave.top.chn isl-local.chn isl.chn CHNBLDARGS=-top slave.top.chn -local isl-local.chn -ether isl.chn isl: isl-dom.m4 isl-chn.m4 isl-dom.m4: isl.mk ../Dombuild -o isl-dom.m4 ------------------------------------- and it spits out command not found errors for the DOMFILES and DOMBLDARGS. On ultrix substitution doesn't take place when the word is in brackets, whereas with ash and bash it does. What should happen? Is there some way to get the ultrix behaviour with ash or bash, otherwise I'm going to have to rewrite the script. -- Paul Richards, University of Wales, College Cardiff JANET:paul@uk.ac.cf.isl Internet:paul@isl.cf.ac.uk UUCP: paul@cf-isl.UUCP or ...!uunet!mcsun!uknet!cf!isl!paul