Opened 10 years ago

Closed 10 years ago

#4156 closed enhancement (fixed)

Don't write command to history when it's the same as previous command

Reported by: idefix Owned by: jackburton
Priority: normal Milestone: R1
Component: Applications/Terminal Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

When you issue the same command multiple times after each other in the Terminal, they all get written to .bash_history. This is extremely frustrating when you move up in the history with the up-arrow key.

I would like to see this changed; just as changeset:30953 did for the history in KDL.

Change History (6)

comment:1 by anevilyak, 10 years ago

This could probably be considered a duplicate of ticket #2118 ... this is builtin bash behavior that's been changed in more recent versions of bash, at least based on my linux install here.

comment:2 by pulkomandy, 10 years ago

seen in my .bashrc in debian:

# don't put duplicate lines in the history. See bash(1) for more options # don't overwrite GNU Midnight Commander's setting of `ignorespace'. export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups # ... or force ignoredups and ignorespace export HISTCONTROL=ignoreboth

Should this work ?

in reply to:  2 ; comment:3 by idefix, 10 years ago

Replying to pulkomandy:

Should this work ?

Yes, I issued export HISTCONTROL=ignoredups on the command line and it now behaves as I would like it to.

I would like to see this behaviour the default; but if it's the default in more recent versions of bash (as anevilyak pointed out), this ticket might as well be closed as duplicate of ticket:2118.

in reply to:  3 comment:4 by anevilyak, 10 years ago

Replying to idefix:

I would like to see this behaviour the default; but if it's the default in more recent versions of bash (as anevilyak pointed out), this ticket might as well be closed as duplicate of ticket:2118.

Based off pulkomandy's information, I'm actually no longer certain if that's a default or something this particular distro put into the default bashrc, which we could certainly do in Haiku as well in any case.

comment:5 by idefix, 10 years ago

Yes, please. Apparently, even Ubuntu is doing it. :)

comment:6 by mmlr, 10 years ago

Resolution: fixed
Status: newclosed

Done in hrev31953. Thanks for all the research!

Note: See TracTickets for help on using tickets.