unix redirect tail to file unix redirect tail to file unix unix

unix redirect tail to file


I am waiting for your confirmation to my previous comment. But in the meantime, I am going to assume the affirmative and give you a suggested solution.

Placing a ! at the end of the > or >> redirects will turn off the default "noclobber" switch that prevents overwriting an existing file:

tail -f -n1 amroutput >! amr_lastoutput

If this does not work for you, let me know and we can try something else.


the redirect '>' of tail only one times overwrite to a output file.I use the while loop with sleep and run the tail command periodically.

Thanks for all!