*BSD News Article 9941


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA6846 ; Fri, 15 Jan 93 10:37:04 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!uunet!mcsun!uknet!cf-cm!myrddin.isl.cf.ac.uk!paul
From: paul@isl.cf.ac.uk (Paul)
Newsgroups: comp.unix.bsd
Subject: Differences with here documents
Message-ID: <1993Jan15.230023.5307@cm.cf.ac.uk>
Date: 15 Jan 93 23:00:21 GMT
Sender: news@cm.cf.ac.uk (Network News System)
Organization: Intelligent Systems Lab, ELSYM, Universiity of Wales, College of 
              Cardiff.
Lines: 37

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?
-- 
  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