Hi!
If you haven't, read the man pages for cat and echo, to see where most of the difference lies (type 'man cat' or 'man echo' in a console)
From my limited experience, there isn't much difference in the functionality of getting info into a file. However, I believe the cat statement(s) would require slightly less code. To show this, consider the following example, which you can do in a console:
Example a)
Code:
echo "Hello, this is a sentence" > file.txt
echo " This is another sentence" >> file.txt
echo "This is sentence number three" >> file.txt
echo "This is the fourth and last sentence" >> file.txt
cat file.txt
Example B)
Code:
cat << EOF > file.txt
>This is sentence one.
>this is sentence two!
>This is sentence number three...
>And finally, number four. Were done.
>EOF
cat file.txt
Note that there is less repetition using cat, because you don't need to use the quotes and the word 'echo' with every line.
Now, with echo however, you could do something like :
Code:
echo -e "This is sentence one \nThis is sentence two\nThis is sentence number 3\nAnd this is sentence number four\n" > file.txt
cat file.txt
And wind up with the same results. The -e switch makes echo interpret escape characters (like \n for newline).
Note that the > means 'make the file if it does not exist, or overwrite it if it exists'
Using >> means 'append to the file if it exists, or make it if it does not exist'
Does this help any?