[Bug 46441] sh(1): Does not support PS1, PS2, PS4 parameter expansion

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 19 Oct 2025 23:03:01 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=46441

--- Comment #22 from Jilles Tjoelker <jilles@FreeBSD.org> ---
Comment on attachment 264503
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=264503
PS1/PS2 parameter expansion patch v2

I like it. Please confirm the author name and email address to be written into
Git.

I have some nits but I can fix them myself.

Nit: existing code does not check `is_in_name` on the same character `is_name`
returned true for, but increments the pointer (`fmt` here) in between.

Nit: line 2124 till 2132 (`/* Positional parameters - check digits FIRST */`
and `} else if (namelen == 1 && is_special(*varname)) {`) are not indented
correctly.

Nit: `valbuf` on line 2134 is `static` but if `varname` above can live on the
stack then so can `valbuf`.

Some things like `$-` and `${10}` don't work but let's not add them to avoid
adding even more duplicated code. I expect the implemented parts to be almost
all of what people will actually use.

-- 
You are receiving this mail because:
You are on the CC list for the bug.