[BusyBox] More wandering through busybox sed source...
Rob Landley
rob at landley.net
Sat Sep 13 23:13:52 MDT 2003
On Saturday 13 September 2003 21:54, Glenn McGrath wrote:
> I think acording to posix 's/a/b/;s/b/c/' and 's/a/b/ s/b/c/' are
> supposed to be the same
>
> But now im confused acording to posix is 's/a/b/ g' one command or two ?
>
>
> Posix says
>
> The script shall consist of editing commands of the following form:
>
> [address[,address]]function
>
> The command can be preceded by <blank>s and/or semicolons. The function
> can be preceded by <blank>s. These optional characters shall have no
> effect.
In this case, the g is an option to the s command, not the start of a new
command. gnu sed is parsing it as such, and complaining that it doesn't know
what a space means as an option to the s command. It's not clear where the
previous command terminated (unless you're allowed to just terminate it with
the first thing you don't recognize). I thought that was what the semicolons
were for.
Can you just run together commands otherwise? (Who wrote this spec?)
> Command verbs other than {, a, b, c, i, r, t, w, :, and # can be followed by
> a semicolon, optional <blank>s, and another command verb. However, when the
> s command verb is used with the w flag, following it with another command in
> this manner produces undefined results.
Okay, so when you do NOT use the w flag, then a space (or basically anything
else you don't recognize) should mark the start of a new command. That
positively sucks, and gnu gets it wrong. It means that adding flags in
future could break existing scripts, although I guess that's what the
semicolon is for...
On a side note, I notice that numeric and w flags to the s command aren't
implemented yet. Would it help if I compiled a list of stuff like this, or
do you have one?
> Glenn
Rob
More information about the busybox
mailing list