why does the command tail testfiletestfile no

January 10, 2011 at 08:36:29
Specs: Windows 7
this is an assignment im taking, intro to linux and been stuck on this forever! anyone help me out?

See More: why does the command tail testfiletestfile no

Report •

#1
January 10, 2011 at 08:37:35
sorry, im new to this, why does the command tail testfile>testfile not work? Thanks

Report •

#2
January 10, 2011 at 11:48:46
The act of redirecting standard output to a file initializes the output to null destroying the contents. Therefore, redirecting to the same file that you are tail'ing:

tail testfile>testfile

destroys the contents of testfile leaving tail nothing to act on.

Try it out by using some other file name:

tail testfile > myfile

The content of myfile will only have the last 10 lines of testfile with the previous content of testfile being destroyed.


This command appends the last 10 lines of testfile to itself:

tail testfile>> testfile


Report •
Related Solutions


Ask Question