.bash_histoty

Ralph E. Kenyon, Jr. diogenes at xenodochy.org
Fri Apr 22 01:12:28 UTC 2005


On Thu, 21 Apr 2005 17:09:30 -0400, Stuart Sears <stuart at sjsears.com>  
wrote:

> On Thu, 2005-04-21 at 16:42 -0400, Ralph E. Kenyon, Jr. wrote:
>> Is it possible to alter the functioning of bash_history?
>>
>> I would like to see a duplicate entry treated as follows:
>>
>> Bring it to the bottom (deleting the prior entry)
>>
>> So that the "adjusted" history has a list of commands, without  
>> duplicates,
>> in the order that they were last used.
>>
>> Is it possible to "hack" this functionality in in some way?
> hacking is not really needed - bash has similar functionality built in.
>
> man bash (and a bit of judicious searching) gives...
> 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 regardless of the
> value of HISTCONTROL.
>
> export HISTCONTROL=erasedups
> in your ~/.bash_profile should do the trick (or something very much like
> it)
>
> HTH
>
> Stuart
> --
> Stuart Sears RHCE RHCX RTFM

Thanks, Stuart,
It looks lie Redhat 9 does not support erasedups

-- 
Ralph E. Kenyon, Jr.
http://www.xenodochy.org/ralph.html
191 White Oaks Road
Williamstown, MA 01267-2259
Phone: 413-458-3597

Home pages:
http://www.xenodochy.org
http://www.ballroomdances.org
-------------------------------------------------------
FIGHT SPAM http://www.xenodochy.org/diogenes/antispam.html
(If you are thinking about collecting my email address, read the above  
page first!)
--------------------------------------------------------
Keep our semantic environments and cyberspace clean.
Always report errors discovered while surfing the web.
------------------------------------------------------
My favorite saying (from general semantics):
It's not that seeing is believing, believing is seeing,
and we're much better at believing than we are at seeing.
http://www.xenodochy.org/ex/quotes/santayana.html




More information about the Redhat-install-list mailing list