bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] preserve $_ value across prompt expansions


From: Grisha Levit
Subject: Re: [PATCH] preserve $_ value across prompt expansions
Date: Thu, 14 Dec 2023 13:24:17 -0500

On Thu, Dec 14, 2023, 12:51 Chet Ramey <chet.ramey@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.

But I don't think that doing so would actually be a problem -- either
approach seems fine to me.

>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]