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

Forside
Vedhæftede filer:
Indlæg som e-mail
+ (text/plain)
Slet denne besked
Besvar denne besked
Skribent: Kevin Buettner
Dato:  
Emne: 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