Reputation: 21
Currently I have a script like this.
#!/bin/bash
Fun()
{
echo "blah1" >> File
echo "blah2" >> File
echo "blah3" >> File
echo "blah4" >> File
echo "blah5" >> File
}
Fun
Cat File | mail -s ' Here is a file [email protected]
When this file gets sent to my email I get my text like this.
blah1,blah2,blah3,blah4,blah5
Is there anyway where I can get my results like this?
blah1
blah2
blah3
blah4
blah5
I tried adding a echo >> file command after each line but it results in this which I do not want for various reasons later on.
blah1
blah2
blah3
blah4
blah5
Upvotes: 0
Views: 46
Reputation: 2210
Use below instead of "echo"
echo -e "blah1 \n" >> File
OR use below to create a file in fun().
cat <<EOF >File
blah1
blah2
..
EOF
To append the same file.. use (note extra '>')
cat <<EOF >>File
blah5
blah6
EOF
Upvotes: 1