Putting echoed text into a new file

Hi,

I've set up a script so that a user answers questions, and then these answers come back onto the screen accompanied by text that I've echoed. Is there a way of putting this into a new file?

Thanks

Simple shell redirection can put text into a new file.

echo "text" > newfile

thanks!

so if I had several lines of echoed text, I'd put that after after line? Or after the whole block?

This erases what is in "somefile" and puts "Something in it"

echo "Something" > somefile

This appends "Something" to "somefile"

echo "Something" >> somefile

Is there a way to doit so that it copies it rather than moving it?

So I have

echo "blah blah blah"
echo "blah blah"
echo "blah blah blah blah"
echo "blah blah blah"

and I'd like to copy all of that output to a new file, but still having it displayed on the screen.

echo "blah blah blah" | tee somefile
echo "blah blah" | tee -a somefile
echo "blah blah blah blah" | tee -a somefile
echo "blah blah blah" | tee -a somefile

look into 'man tee'

Thanks.