Hack 57. HISTCONTROL を使用して履歴から継続的に繰り返されたエントリを排除する

次の例では、pwd が3回入力されました。
history を実行すると、pwd が全部で 3 回続いていることがわかります。
重複を排除するために、以下に示すように HISTCONTROL に ignoredups をセットします。

# pwd
# pwd
# pwd
# history | tail -4
        44 pwd 
        45 pwd 
        46 pwd 
        47 history | tail -4 
[Note: 上で示すように pwd を 3 回実行した後、履歴に 3 つ pwd コマンドがあります。]

# export HISTCONTROL=ignoredups
# pwd
# pwd
# pwd
# history | tail -3
        56 export HISTCONTROL=ignoredups 
        57 pwd 
        58 history | tail -4
[Note: 上で示すように pwd を 3 回実行した後、履歴に 1 つだけしか pwd コマンドがありません。]