help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] 'bash' in 'bash' + 'set +o history'


From: Greg Wooledge
Subject: Re: [Help-bash] 'bash' in 'bash' + 'set +o history'
Date: Fri, 6 Sep 2019 08:44:37 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Fri, Sep 06, 2019 at 10:22:53AM +0000, address@hidden wrote:
> I wonder if anyone can point out the reason for the following behaviour:
> 
> 1. 'set +o history' in '/etc/profile'

That's the wrong place for that setting.

> 2. 1st 'bash' session respects this setting, no command history file is
> written
> 3. From the 1st 'bash' session a 2nd one is started (parent process of the
> 2nd one is the 1st)
> 4. The 2nd session logs history

The second one was probably invoked by typing "bash", or something similar.
This means it's a NON-login shell, and therefore, it does not read
/etc/profile or ~/.bash_profile or ~/.bash_login or ~/.profile.

A non-login shell only reads ~/.bashrc.  It may possibly also read some
file in /etc if your vendor compiled bash to use an additional bashrc
file -- some vendors use /etc/bashrc and some use /etc/bash.bashrc and
some don't use any at all (the default behavior).

Your preference for not saving history is unique to you, so it should
be enabled in your ~/.bashrc file.  That way, it only affects you,
and not the other users on your system.  If your other users want that,
they can put it their ~/.bashrc files as well.

Most other users that we meet in #bash want the exact opposite of what
you want -- they want INFINITE history, or as close as possible.  So,
I'm fairly confident in my assertion that you shouldn't be trying to
disable history system-wide.



reply via email to

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