0

Sorry if this has been discussed, wasn't sure what to use to search for the particular question I had.

I'm installing sickrage and couchpotato and headphones, and will be doing multiple installs I made a small batch script just to install everything but what I don't know how to do is automatically make them auto start on boot. Since they all require a file to be created I do not know how to make this file auto create and populate what needs to be put into it.

3
  • 1
    In bash scripting touch will create a new file and >> will append to the end of a file. Ex. touch newfile && echo This is a test >> newfile
    – karel
    Aug 23, 2014 at 19:56
  • Can you give an example of what needs to be populated? If it's anything more than a couple of lines, I'd use a here document. Aug 23, 2014 at 19:59
  • Would you mind sharing your bash script?
    – user319848
    Aug 23, 2014 at 21:53

1 Answer 1

0

As Karel suggested you can use touch to create the file and other commands to populate it:

Now Assuming you have created a file as follows: touch path/to/file we can use the following methods to populate it:

printf "Hello world\nNow a new line" >> path/to/file

or

echo "Hello world\nNow a new line " >> path/to/file

you can use >> to append to the file or > to replace everything in the file with new content.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .