[gnu.bash.bug] History, actually not a bug, but a documentation suggestion

bet@ORION.MC.DUKE.EDU (Bennett Todd) (07/27/89)

I started off with the following bug complaint:

|I include the history number in my prompt so that, if a command is still
|on the screen, I can refer to it via
|
|	!number
|
|Bash 1.01 didn't handle that. In particular, using 55-line-long MGR
|windows (my normal window size -- boy are they addictive!) I looked
|halfway up the screen and saw that the command I wanted to re-execute
|was number 19, and here's what happened:
|
|	bent[29] !19
|	19: Event not found.
|
|Drat.
|
|Hey, waitaminit, I just typed "history", and (a loooong time later,
|after much scrolling) I found that command at *519*!!! And, sure enough,
|"!519" worked! Either the reference (in features) to:
|
|        \#      the command number of this command
|
|(in the section on "the comment next to the decode_prompt_string
|function") or the reference:
|
|	`!n'
|	     Refer to command line N.
|
|(in "Event Designators" in "History Expansion") has a problem. Frankly,
|I wish that they both were true. However, it looks like they are at odds
|with attempting to have the command history persist via the external
|file, in the face of multiple bashes on multiple windows.
|
|Waitaminitagain!
|Hmmm...

... and I figured it all out! Brian, terrific job!

Some folks *like* C-shells property of lacking externally recorded
history, having totally separate and unrelated histories for each
invocation of a shell. I confess to being one of these poor old
inflexible lusers. You might mention in the docs that such folks can
keep their defective preferences if they

	(1) Create a directory "~/.bash-histories" (for example)
	(2) Add to .bashrc the incantation:
	    	HISTFILE=~/.bash-histories/$$
	    (making sure of course that .bashrc is sourced from
	    .profile).
	(3) Add to .bash_logout the following:
	    	rm ~/.bash-histories/*

Far out! Now *everybody* can be happy!

Thanks again for the great shell!

-Bennett
bet@orion.mc.duke.edu

molenda@umn-cs.CS.UMN.EDU (Jason S. Molenda) (08/01/89)

bet@ORION.MC.DUKE.EDU (Bennett Todd) writes:

>	(1) Create a directory "~/.bash-histories" (for example)
>	(2) Add to .bashrc the incantation:
>	    	HISTFILE=~/.bash-histories/$$
>	    (making sure of course that .bashrc is sourced from
>	    .profile).
>	(3) Add to .bash_logout the following:
>	    	rm ~/.bash-histories/*

>Far out! Now *everybody* can be happy!

  even easier is to create a file '~/.bash_history', put the line
HISTFILE=~/.bash_history in your .bashrc file and then chmod the
file to 444 (-r--r--r--) and bash won't be able to write to the
file so your history will not be recorded.

>-Bennett
>bet@orion.mc.duke.edu

Jason molenda, molenda@umn-cs.cs.umn.edu

bet@ORION.MC.DUKE.EDU (Bennett Todd) (08/01/89)

>  even easier is to create a file '~/.bash_history', put the line
>HISTFILE=~/.bash_history in your .bashrc file and then chmod the
>file to 444 (-r--r--r--) and bash won't be able to write to the
>file so your history will not be recorded.

Sure enough, that is importantly simpler. Thanks!

Could some mention of one or another of these hacks be added to the
documentation?

-Bennett
bet@orion.mc.duke.edu

bfox@AUREL.CALTECH.EDU (Brian Fox) (08/01/89)

   Date: Tue, 1 Aug 89 08:25:53 EDT
   From: bet@orion.mc.duke.edu (Bennett Todd)
   X-Zippy: I know th'MAMBO!!  I have a TWO-TONE CHEMISTRY SET!!

   >  even easier is to create a file '~/.bash_history', put the line
   >HISTFILE=~/.bash_history in your .bashrc file and then chmod the
   >file to 444 (-r--r--r--) and bash won't be able to write to the
   >file so your history will not be recorded.

   Sure enough, that is importantly simpler. Thanks!

   Could some mention of one or another of these hacks be added to the
   documentation?

   -Bennett
   bet@orion.mc.duke.edu

(From the Soon to be Released Major Program "Bash 1.03 - the final frontier")

  /* Save the history of executed commands. */
  if (interactive)
    {
      char *hf = get_string_value ("HISTFILE");
      if (hf)
	write_history (hf);
    }

Which just means that saying

	unset HISTFILE

in your .bashrc file will prevent the history file from being written.

Patience, good things come to those who wait.

	Brian Fox