On 12/14/23 1:24 PM, Grisha Levit wrote:
On Thu, Dec 14, 2023, 12:51 Chet Ramey <chet.ra...@case.edu <mailto:chet.ra...@case.edu>> wrote:

    On 12/12/23 3:55 PM, Grisha Levit wrote:
     > Since expanding a prompt string that contains a funsub will modify the
     > value of $_, would it make sense to restore the value of $_ after the
     > expansion is complete, as we do when executing PROMPT_COMMAND?

    If we're worried about this as a side effect, why not preserve $_ around
    calls to function_substitute()? Or are the prompt string expansions the
    only reasonable use case?


I was concerned that since $_ "expands to the
last argument to the previous simple command executed in the foreground", and commands in funsubs fit that criteria it might not be exactly correct to preserve $_ around funsubs in general.

We'll start with decode_prompt_string and see if any other use cases
present themselves.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to