解决方法
我建议使用
moreutils的海绵.从联机帮助页:
DESCRIPTION sponge reads standard input and writes it out to the specified file. Unlike a shell redirect,sponge soaks up all its input before opening the output file. This allows for constructing pipelines that read from and write to the same file.
要将此问题应用于您的问题,请尝试:
uniq .bash_history | sponge .bash_history