[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed --posix does not catch incomplete arguments
From: |
Ralf Wildenhues |
Subject: |
Re: sed --posix does not catch incomplete arguments |
Date: |
Sat, 19 Jun 2010 12:46:07 +0200 |
User-agent: |
Mutt/1.5.20 (2010-04-22) |
* Bruno Haible wrote on Sat, Jun 19, 2010 at 12:55:51AM CEST:
> address@hidden
> + nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
> + line1='/^[0-9]/@{'; \
> + line2='s/^\([0-9]*\).*/\1/p'; \
> + line3='q'; \
> + line4='@}'; \
> + line5='c\'; \
> + line6='0'; \
> + line7='q'; \
> +
> address@hidden@address@hidden@address@hidden@address@hidden@address@hidden@};
> \
> +
> address@hidden@address@hidden@address@hidden@address@hidden@address@hidden@};
> \
> +
> address@hidden@address@hidden@address@hidden@address@hidden@address@hidden@};
> \
> + major=`echo '$(VERSION)' | sed -n -e "$$sed_script"`
> address@hidden 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