Linux: How to use a file as input and output at the same time?

Posted by MilliaLover on Server Fault See other posts from Server Fault or by MilliaLover
Published on 2010-04-24T18:32:58Z Indexed on 2010/04/24 18:43 UTC
Read the original article Hit count: 91

Filed under:
|

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.

© Server Fault or respective owner

Related posts about linux

Related posts about bash