Is there a particular reason you are trying to create and edit a file without using and editor?

If you have a typo, or if there is something in the that your new entry might conflict with you may not know.

Doing this as a super user (root / sudo) seems to me to be asking for trouble.

Of course it depends on what you are trying to do.

If you are modifying configuration files in particular I see possibility of unrecoverable excitement.


The apache configuration file has a lot of the settings already in there and often you just need to uncomment them to activate the option. Of course you would be working on it only after making a backup copy of the file.

When you have finished creating a file from the command line you would use Control D to end the edit mode.

Typing eof will just put the characters eof into the file.

HM


On 03/09/2015 08:51 PM, Michael Havens wrote:
do you think this would have the desired effect?


sudo cat >> /etc/apt/apt.conf  << eof
Acquire::Queue-Mode "host";
eof

sudo cat >> /etc/sysctl.conf << eof
# Reduce the swap tendency 
vm.swappiness = 10
eof

sudo cat >> /etc/apache2/apache2.conf << eof
Include /etc/phpmyadmin/apache.conf
eof

sudo cat >> /etc/fstab << eof
/media/bmike1/entertainment/Pictures /home/bmike1/Pictures none bind 0 0 
eof

would the single line appendages just need the blank line?

:-)~MIKE~(-:

On Mon, Mar 9, 2015 at 8:41 PM, Michael Havens <bmike1@gmail.com> wrote:
Okay now, I learned just today how >> works and I want to update all of my reinstall scripts so all I need to do is copy-n-paste into a terminal and everything will be done. Learned when I was doing Linux from scratch  that to create a file of multiple lines without starting an editor you do:

cat > filename << "EOF"
contents 
of
file
EOF
 Oh.... I think I get it. just turn the '>' into '>>'
am I correct? 

:-)~MIKE~(-:



---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss