I want to learn to use the shell and was wondering why this …

Páxina inicial
Anexos:
Mensaxe orixinal
+ (text/plain)
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Kevin Buettner
Data:  
Asunto: I want to learn to use the shell and was wondering why this didn't do as expected
On Feb 20, 1:25pm, Michael Havens wrote:

> Why did my version (sort mypasswd >mypasswd |cat mypasswd) erase it?


Because the redirection operator opens and truncates the file. This
is done by the shell before the sort program even gets a chance to do
its own open() of the file.

Kevin