how to send shell variable data to a text file
Writting a very very simple shell script, the script contains some variables which i want displayed with a sentence i.e.
hello $1 whats up, what you doing $2 do you like $3 I want to send this data to a text file, i tried cat << _EOF_ blah blah blah _EOF_ >> /home/blah/blah.log any ideas how to achieve this. Thnaks in advance. |
"hello $1 whats up, what you doing $2" > somefile.txt
"do you like $3" >> somefile.txt |
would the text be written to file exactley hows its presented in the text, i.e. the overal format, positioning of each sentence.
Thanks |
yes, most probably. just try to format the content as you would like to appear in the text file and re-direct in to the file. its more like try and correct thing.
|
Try it the other way round:
Code:
cat > file << EOF |
Put the redirection on the same line as the cat command:
cat << _EOF_ >> ~/blah.log |
Thanks guys, really helpful stuff, this is why i love being part of this community :)
|
yeah, we love it too ;)
|
All times are GMT -5. The time now is 02:21 PM. |