0

With this script I want to append a line of text to the /etc/hosts file. The script seems not to be working. What is wrong?

su 
cd /etc
cat /home/rugile/file >> hosts

And /home/rugile/file looks like this:

127.0.0.1 domain.com
eksponente
  • 49
  • 2
  • 9

1 Answers1

1

su opens a new shell. You need to feed it the commands.

su << EOF
 ...
EOF
Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358