WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: midnight commander - every action is journaled in .bash_history  (Read 9632 times)

Offline netnomad

  • Hero Member
  • *****
  • Posts: 1027
midnight commander - every action is journaled in .bash_history
« on: November 19, 2012, 11:35:09 PM »
hi friends,

i use extensively the midnight-commander in the bash started in aterm.
unfortunately every single action in the midnight-commander is included in my ~/.bash_history:

.bash_history:
 mc
 PROMPT_COMMAND='pwd>&8;kill -STOP $$'
 cd "`printf "%b" '\0057home\0057tc'`"
 cd "`printf "%b" '\0057home\0057tc\0057\0056fluxbox'`"
 cd "`printf "%b" '\0057home\0057tc'`"
 cd "`printf "%b" '\0057home\0057tc\0057\0056gconf'`"

so the real important commands are hidden or lost in the bash-history :(
 
what would you recommend to get rid of that "feature"?

thank you for your help.
« Last Edit: November 19, 2012, 11:38:46 PM by netnomad »

Offline althalus

  • Sr. Member
  • ****
  • Posts: 351
Re: midnight commander - every action is journaled in .bash_history
« Reply #1 on: November 20, 2012, 12:27:28 AM »
Hi netnomad,

A quick google search turns up this debian bug report, specifically:

Quote
Here a citate of README.Debian (please read it before filling bugs):
-------------------
 -  In order to get rid of the commandline history to be full with cd commands
    from the both boxes set this environment variable:
     export HISTCONTROL=ignoreboth

    This is a issue of bash, not of mc. This would fix it.
-------------------

(Note: I didn't test that it actually works)

Offline netnomad

  • Hero Member
  • *****
  • Posts: 1027
Re: midnight commander - every action is journaled in .bash_history
« Reply #2 on: November 20, 2012, 04:23:52 AM »
hi althalus,

thanks a lot, it works!

by the way,
could you help me with HISTSIZE, too?
i wasn't able to extend it from 500 to 1000, yet :(

./bashrc
source /usr/local/etc/bashrc
export HISTCONTROL=ignoreboth
export HISTSIZE=1000

thank you for your help.

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6831
Re: midnight commander - every action is journaled in .bash_history
« Reply #3 on: November 20, 2012, 05:55:16 AM »
Hi netnomad
Maybe try adding it to  .profile?

Offline netnomad

  • Hero Member
  • *****
  • Posts: 1027
Re: midnight commander - every action is journaled in .bash_history
« Reply #4 on: November 20, 2012, 06:09:49 AM »
hi rich,

.profile has no effect for this issue,
only the entry in .bashrc has any effect.

by the way,
export HISTCONTROL=ignoredups,erasedups
has no effect, too.

does someone know whether the syntax
export HISTCONTROL=ignoredups,erasedups
or
export HISTCONTROL=ignoredups:erasedups
is the correct entry?

this is the last version of my
.bashrc
source /usr/local/etc/bashrc
export HISTCONTROL=ignoreboth,erasedups
export HISTSIZE=1000
export HISTFILESIZE=1000000

thank you for your contributions.
« Last Edit: November 20, 2012, 06:16:07 AM by netnomad »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10036
Re: midnight commander - every action is journaled in .bash_history
« Reply #5 on: November 20, 2012, 10:37:07 AM »
man bash says to use colons, ":".
The only barriers that can stop you are the ones you create yourself.

Offline netnomad

  • Hero Member
  • *****
  • Posts: 1027
Re: midnight commander - every action is journaled in .bash_history
« Reply #6 on: November 20, 2012, 12:29:11 PM »
hi rich,

thank you, you are right,
but

.bashrc
source /usr/local/etc/bashrc
export HISTCONTROL=ignoreboth:ignoredups:erasedups
export HISTSIZE=1000
export HISTFILESIZE=1000000

has still no effect on the dups:(

.bash_history
mc
exit
exit
ls
exit
mc
ls
exit

Offline althalus

  • Sr. Member
  • ****
  • Posts: 351
Re: midnight commander - every action is journaled in .bash_history
« Reply #7 on: November 20, 2012, 02:15:27 PM »
export HISTCONTROL=ignoreboth:ignoredups:erasedups

Try this:

HISTCONTROL="ignorespace:erasedups"

No noise from mc, and no dups in my bash history.

The wording for HISTCONTROL suggested to me that cramming all the options together causes some sort of conflict. Testing seems to confirm that my thinking is heading in the right direction.
Quote

       HISTCONTROL
              A colon-separated list of values controlling how commands are saved on the history list.  If the list of values includes ignorespace, lines
              which begin with a space character are not saved in the history list.  A value of ignoredups causes lines  matching  the  previous  history
              entry  to not be saved.  A value of ignoreboth is shorthand for ignorespace and ignoredups.  A value of erasedups causes all previous lines
              matching the current line to be removed from the history list before that line is saved.  Any value not in the above list is  ignored.   If
              HISTCONTROL  is  unset, or does not include a valid value, all lines read by the shell parser are saved on the history list, subject to the
              value of HISTIGNORE.  The second and subsequent lines of a multi-line compound command are not tested, and are added to the history regard‐
              less of the value of HISTCONTROL.

Offline netnomad

  • Hero Member
  • *****
  • Posts: 1027
Re: midnight commander - every action is journaled in .bash_history
« Reply #8 on: November 20, 2012, 11:21:03 PM »
Quote
No noise from mc, and no dups in my bash history.

hi friends,

i didn't succeed with the "no dups" :(
although i checked ~/.ashrc, ~/.bashrc and ~/.profile and tried so many different configurations...
i even changed the /usr/local/etc/bashrc,
but at least the noise is gone :)

thank you for your help.
« Last Edit: November 21, 2012, 06:04:56 AM by netnomad »