*BSD News Article 9977


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA6906 ; Fri, 15 Jan 93 10:38:54 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!spool.mu.edu!agate!usenet.ins.cwru.edu!odin!chet
From: chet@odin.ins.cwru.edu (Chet Ramey)
Newsgroups: comp.unix.bsd
Subject: Re: Differences with here documents
Date: 16 Jan 1993 20:51:41 GMT
Organization: Case Western Reserve University, Cleveland OH (USA)
Lines: 41
Message-ID: <1j9sgtINNfvq@usenet.INS.CWRU.Edu>
References: <1993Jan15.230023.5307@cm.cf.ac.uk>
NNTP-Posting-Host: odin.ins.cwru.edu

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.

Well, the ultrix shell might be trying to do the substitution,
but it doesn't understand the new-style ksh/Posix.2/ash/bash
form of command substitution: $(command).  It doesn't try any
command substitution, the line doesn't change, and it's output
as entered.

>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).

Nope.  Just means they're slightly behind the times.  (Well, in the
case of Ultrix, *way* behind the times.)

>What is correct POSIX behaviour?

Bash and ash are doing the right thing, according to Posix.2.

Chet
-- 
``The use of history as therapy means the corruption of history as history.''
	-- Arthur Schlesinger

Chet Ramey, Case Western Reserve University	Internet: chet@po.CWRU.Edu