I want to make automatically fill the text file that I made but I don't know how, I want to make a .sh script to work automatically but I don't know how. the script that I have thought of for example like this
touch " ubuntu story "
after this I want to fill in the text in my story file, for example the text you want to add like this
Ubuntu is one of the most secure operating systems around. And the long-term support releases give you five years of security patches and updates.
Developer = Canonical Ltd.
OS family = Linux
Working state = Current
Source model = Open-source[1][2]
Initial release = 20 October 2004 (15 years ago)
how to addin this text to file ubuntu story with script ?
if using the manual method I can use this method
nano "ubuntu story"
after that I paste in the terminal column, then I Ctrl + X + Y + Enter
, after that it will be saved.
please help me if you use the bash .sh script
In some of my scripts I do something like this:
Or:
Note that one > overwrites or creates new file and >> adds to end of file. I have additional data I add to log file. Also better with Linux to use CamelCase, under_score or justonename rather than spaces. You have to escape spaces in future commands which makes it more complicated.
You can use a here document
Quoting of any part of the word
EOF
either as\EOF
or'EOF'
for example prevents shell expansion of the contents.I used a bash shebang since that's what you tagged your question, but here documents are supported in all POSIX shells.