Works for me. Do both the duplicates and spaced commands show in your history?
You realize the dups only apply to the previous line. That is if I type:
then only one ls in the history. But if I type:
both ls's will be in the history.
If you do an export from the command line does is HISTCONTROL set in your environment?
No quotes should be needed, not using them on Lion but this should be fairly OS independent.
I tried setting and resetting from command prompt HISTCONTROL variable, and at the end I had the same environment variables in my .bashrc file as before but strangely before it was only ignoring the spaced command but now it does ignore the immediate duplicate and spaced commands too, which I don't understand. Anyway is there anyway to not to record any duplicate commands from the history. I mean the all duplicate commands have only one entry in the history? This would be quite useful for me.
No way to remove duplicates earlier in the history file that I am aware of.
You could write something to go through the history file and remove duplicates, wouldn't be to hard or they may be a script out there that does that. Using sort and uniq would do it except the commands would not be in the file in the order they were entered on the command line if that is a problem.
sort .bash_history | uniq -d
should be a starting point.