Ken M <k...@mack-z.com> wrote:
> OK, so confession 1, I am a long time bash user
> confession 2 all of my ksh experience is on solaris
> 
> However in a when in Rome moment I am realizing how much I like ksh in 
> openbsd,
> but one minor thing. I don't like how much clear ends up in my history file. 
> So
> I am wondering what I can do to suppress a command going to history.
> 
> 
> Lets put my .profile here for reference
> 
> # $OpenBSD: dot.profile,v 1.5 2018/02/02 02:29:54 yasuoka Exp $
> #
> # sh/ksh initialization
> 
> . /etc/ksh.kshrc
> 
> PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:$HOME/.local/bin
> PS1="[\u@\h: \W]$ "
> HISTFILE=$HOME/.ksh_history
> HISTSIZE=1000
> export PATH HOME TERM PS1 HISTFILE HISTSIZE
> 
> # For now clearing out clear from history when starting
> sed -i '/^clear$/d' $HISTFILE
> 
> bind -m '^L'=clear'^J'
> # I wish this worked
> # bind -m '^L'=clear'^J';sed -i '$d' $HISTFILE
> 
> alias ll='ls -l'
> alias la='ls -la'
> alias watch='gnuwatch'
> 
> 
> As you can see I tried adding the ; sed after my bind, I also tried it with &&
> sed and that did not work. Both of course remove the sed from history and not
> the clear. I guess I could remove the 2nd to last line. But before I go that 
> sed
> route is there a cleaner way to prevent a command from going to the HISTFILE?
> 
> Ken

you can use HISTCONTROL=ignoredups so you would have only one entry for "clear"
in your history

Reply via email to