https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292912
Dag-Erling Smørgrav <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] Resolution|--- |Works As Intended Status|New |Closed --- Comment #1 from Dag-Erling Smørgrav <[email protected]> --- There is no foundation in either POSIX or the GNU sed manual for your claim that comments should be allowed after a command. Both POSIX and the GNU sed manual describe '#' solely as a command which causes the rest of the line to be ignored. Like any other command, it must be separated from a preceding command by either a semicolon or a blank line. So these variants are allowed by POSIX and supported by BSD sed: % echo foo | sed -e 's/foo/bar/; # comment' bar % echo foo | sed -e $'s/foo/bar/\n# comment' bar % echo foo | sed -e 's/foo/bar/' -e '# comment' bar but this variant is neither allowed by POSIX nor supported by BSD sed: % echo foo | sed -e 's/foo/bar/ # comment' sed: 1: "s/foo/bar/ # comment ": bad flag in substitute command: '#' This last variant appears to be supported by GNU sed, but, importantly, not mentioned in the documentation. The passage you quote from the GNU sed manual does not refer to comments that follow a command, but to the fact that some implementations (not including BSD sed) only allow a comment on the first line of the script. -- You are receiving this mail because: You are the assignee for the bug.
