bug-bash
[Top][All Lists]
Advanced

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

Re: `eval` pollutes the history when it runs "set -o history"


From: Chet Ramey
Subject: Re: `eval` pollutes the history when it runs "set -o history"
Date: Tue, 11 Jun 2019 09:44:20 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.7.0

On 6/11/19 9:38 AM, _y@crans.org wrote:
> Chet Ramey wrote (2019-06-10 15:22):
>> On 6/8/19 3:41 PM, _y@crans.org wrote:
>>>
>>>     What makes me think it is an actual bug is that when the
>>>     "history" option was already enabled, "set -o history" should
>>>     have no effect; yet lines before are not recorded, and lines
>>>     after are recorded.
>>
>> Bash temporarily stops recording commands in the history when you use
>> `eval', but if you turn history back on explicitly using `set -o history',
>> it will honor that.
> 
> In that case, shouldn’t `eval "set -o"' report that the "history" option
> is off while `eval' is running? Currently, it says me that it is on.

Maybe. But the user-visible option that says whether or not to save
commands in the history is decoupled from the internal set of flags that
control it. The option should remain visibly on unless the user turns it
off, even if saving commands in the history is temporarily suppressed. The
thing is that enabling history with `set -o history' turns all of these
things on.

> While we are at it, are there other special behaviors of `eval` that one
> should be aware of, particularly regarding doing `eval $(set +o)' ? The
> manual does not say much about the `eval' builtin.

It's not clear, since eval just reads and executes commands. The answer
really depends on the commands you give it.


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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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