Linux: How to use a file as input and output at the same time?
- by MilliaLover
I've just run the following in bash:
uniq .bash_history > .bash_history
and my history file ended up completely empty.
I guess I need a way to read the whole file before writing to it.
How is that done?
PS: I obviously thought of using a temporary file, but I'm looking for a more elegant solution.