On 3/19/12 8:39 AM, Greg Wooledge wrote: > On Fri, Mar 16, 2012 at 06:15:35PM -0400, Chet Ramey wrote:
>> Turn on history with `set -o history' and set HISTFILE and HISTSIZE as you >> like. You can probably set some of the right variables in .ssh/environment >> and set BASH_ENV to a file that will run the commands you want. > > The problem is, that doesn't actually work. > > imadev:~$ ssh localhost bash <<'EOF' > > set -o history >> HISTFILE=~/.bash_history >> HISTFILESIZE=500 >> echo hello world >> EOF > wooledg@localhost's password: > hello world > imadev:~$ tail -2 .bash_history > rm statistical.tcl.rej > less sched.tcl.rej > > I blame this part of the documentation, although perhaps I should be > looking at the code instead: > > When an interactive shell exits, the last $HISTSIZE lines > are copied from the history list to $HISTFILE. > > I read that as "the HISTFILE doesn't get updated when a NON-interactive > shell exits". The documentation is correct. Whether the code should be changed is a different discussion. Saving the history to $HISTFILE in any shell where HISTFILE is set and history is enabled would certainly have made this easier to solve. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/