[Bug 265399] /bin/sh: improve echo -e builtin

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 20 Aug 2022 09:20:43 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265399

--- Comment #5 from Helge Oldach <freebsd@oldach.net> ---
(In reply to Jilles Tjoelker from comment #3)
> For example, the existing echo builtin allows 'echo -n STRING' for any string, while the proposed patch breaks this for the string "-e".

True, so we shouldn't loop over the arguments but only validate the first
argument against being a string of options and check for '-en' or '-ne'. This
will also keep it in line with other built-ins.

> Also note that -ne can be replaced by -e and adding \c to the last operand.

True as well, but then the '-e' option and the '\\' detection logic could be
removed as it's undocumented anyhow...

-- 
You are receiving this mail because:
You are the assignee for the bug.