0

I am writing shell script and I need to display my output at the same time however it doesn't work with 2> somefile.txt and if I do | tee -a somefilel it will not overwrite which I need to . <>

SO, i came up with ... > newfile.txt | cat newfile.txt , however doesn't work for a newfile and need to do chmod, but I have to run my script twice in order to get it work... so i need something more efficient than > newfile.txt | chmod 755 newfile.txt |cat newfile.txt...

Basically I need a shell script I need to display my output at the same time is recording to a file without overwriting, if the file was already exist ...

I hope it make sense :) Thank you

0

Removing the -a from tee will make it overwrite instead of append.

  • yes, it did work. so easy :) – user231620 Jun 16 '13 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.