Insert text into a file using shell script

Hi,

I need to insert "Hello World" text into a file called hai.txt using shell scripting. Kindly help me.

For eg: If I open the file hai.txt by giving linux command cat hai.txt, the content of the file should have the text Hello World in it.

Thanks

You can redirect the output of echo to file.

echo "Hello world." > Hi.txt

for creating new file/overriding data into file

echo "Hello World" > hai.txt

for appending data into file

echo "Hello World" >> hai.txt

That said this look very much homework...

Thanks for all your replies.

Could be explain me with a simple example of EOF in shell. I am very much confused with this.

Plz....

There is a special forum for class assignment / Homework with special rule you must follow
Unless you justify it is not homework the thread is closed