* Bruno Haible wrote on Sat, Jun 19, 2010 at 12:55:51AM CEST:
> +...@example
> +        nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
> +        line1='/^[0-9]/@{'; \
> +        line2='s/^\([0-9]*\).*/\1/p'; \
> +        line3='q'; \
> +        line4='@}'; \
> +        line5='c\'; \
> +        line6='0'; \
> +        line7='q'; \
> +        sed_script...@{line1@}...@{nl@}...@{line2@}...@{nl@}...@{line3@}; \
> +        
> sed_script...@{sed_script@}...@{nl@}...@{line4@}...@{nl@}...@{line5@}; \
> +        
> sed_script...@{sed_script@}...@{nl@}...@{line6@}...@{nl@}...@{line7@}; \
> +        major=`echo '$(VERSION)' | sed -n -e "$$sed_script"`
> +...@end example

Please let's not add overly much indentation to examples, they are
indented already, and the line length in the PDF output is pretty
limited.

I really think this complication stems from unintended wording of the
Posix text, not actual practical limitation: Passing full commands to
-e works everywhere in practice, and the script above can be simplified
to this (including texi and makefile quoting):

major=`echo '$(VERSION)' | \
       sed -n -e '/^[0-9]/@{' \
              -e 's/^\([0-9]*\).*/\1/p' \
              -e q \
              -e '@}' \
              -e 's/.*/0/' \
              -e q`

GCC uses code like
  sed -e :a -e ... -e 't a'

in multiple places and has been for a long time; by above argumentation,
this would be invalid, too.

Cheers,
Ralf

Reply via email to