On Thursday 13 December 2007, Steve Long wrote:
> Mike Frysinger wrote:
> > On Tuesday 11 December 2007, Denis Dupeyron wrote:
> >> On Dec 11, 2007 6:03 AM, Mike Frysinger <[EMAIL PROTECTED]> wrote:
> >> > On Monday 10 December 2007, Donnie Berkholz wrote:
> >> > >       {
> >> > >               ...
> >> > >               echo "CONFIG_EAP_SAKE=y"
> >> > >               ...
> >> > >       } >> ${CONFIG}
> >> >
> >> > cat <<-EOF >> ${CONFIG}
> >> > ...
> >> > CONFIG_EAP_SAKE=y
> >> > ...
> >> > EOF
> >>
> >> Is what you are suggesting better ? If so, why ?
> >
> > no scoping/subshells and obvious break between content (the stuff between
> > EOF) and the commands to get it in there (no echos, just one cat)
>
> ++, although the filename should be quoted ("$CONFIG" or "${CONFIG}")
> Also, in this case, there are no variables being expanded in the heredoc,
> so it makes sense to quote 'EOF':
> cat <<-'EOF' >> "$CONFIG"
> ...
> EOF
> (take off the - sign to keep indentation)
>
> Personally I prefer using embedded multiline echo:
> echo '
> CONFIG_FOO
> CONFIG_BAR
> CONFIG_BLAH
> ' >> "$CONFIG"

the point of using cat with <<- is so that it wont look like crap when you put 
it into the ebuild.  you can use normal tab indentation.  an echo may work in 
a script, but not in an ebuild as the indentation is also placed in the 
output file.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to