Subject: Re: Wierd quoting constructs in sed edit strings
To: Michael South <msouth@msouth.org>
From: Jonathan Perkin <jonathan@perkin.org.uk>
List: tech-pkg
Date: 09/15/2003 15:02:33
* On 2003-09-13 at 09:34 BST, Michael South wrote:

> What's the reason for this?
> 
> ./audio/wmmp3/Makefile: ${SED} -e 's:/usr/local:'${LOCALBASE}':g' \
> 
> The apparently nested single-quotes were freaky, until I figured out 
> that the shell was interpreting it as three concatenated strings:

Single quotes quote verbatim, so without the "nested" quotes you'd
end up with a literal ``${LOCALBASE}'' rather than what the shell
evaluates the variable to, e.g:

  $ FOO=bar
  $ echo ${FOO}
  bar
  $ echo '${FOO}'
  ${FOO}

-- 
Jonathan Perkin                         <jonathan@perkin.org.uk>
BBC Internet Services         http://www.perkin.org.uk/jonathan/