Script using sed adds an "e" to the output files

Solution 1:

You need separate -i and -e arguments to sed. -ie is telling sed to create a backup file with an 'e' appended.

manual entry for <code>-i</code>

To fix, just replace the sed invocation above to:

sudo sed -i -e "s/NEWUSERNAME/$username/" /etc/apache2/sites-available/$newdomain