Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this question
Also asked on superuser -- please stick to one forum please. –  glenn jackman Jun 16 '13 at 23:11
Crossposted; closing –  Michael Mrozek Jun 16 '13 at 23:14
add comment

closed as too localized by Michael Mrozek Jun 16 '13 at 23:14

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

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

share|improve this answer
yes, it did work thank you –  user41271 Jun 16 '13 at 22:43
add comment

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