tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preventing TRAMP from writing duplicate entries to ~/.bash_history


From: SDS
Subject: Re: Preventing TRAMP from writing duplicate entries to ~/.bash_history
Date: Mon, 25 Nov 2013 16:10:20 -0500

On Mon, Nov 25, 2013 at 7:58 AM, Michael wrote:
> SDS writes:
>
>> I've set up my ~/.bashrc initialization file to remove duplicates in the
>> bash history list with
>>
>>> export HISTCONTROL="erasedups"
>>
>> but when TRAMP sends an ssh command, it writes to ~/.bash_history with
>> the line
>>
>>> exec ssh -e none <hostname>
>>
>> without removing duplicates. Is there a way to prevent this? Ideally I'd
>> like to prevent TRAMP commands from writing to bash history at all, but
>> if that's not feasible then removing duplicates would be fine.
>>
>> Sorry if this is an elementary question, I'm inexperienced in these matters.
>
> See the documentation of `tramp-remote-process-environment'. I guess the
> following form in your .emacs would fit your needs:
>
> (add-to-list 'tramp-remote-process-environment "HISTCONTROL=erasedups")

I tried this, but alas, to no avail. I actually have an entry of

> HISTFILE="$HOME/.tramp_history"

in tramp-remote-process-environment, but I don't see any such file in
either my remote or local home directory.

However, it pointed me in the right direction. I managed to stop TRAMP
from writing to local ~/.bash_history using

> (setenv "HISTFILE" "/dev/null")

in my .emacs initialization file. This also prevent emacs shell from
writing to ~/.bash_history though, so I needed to add

> [[ "$EMACS" == "t" ]] && HISTFILE="$HOME/.bash_history"

to my ~/.bashrc to fix that.


Cheers,

SDS



reply via email to

[Prev in Thread] Current Thread [Next in Thread]