#!/bin/bash
egrep -q '^auto eth0' /etc/network/interfaces
if [ "$?" != 0 ]
then
  echo "Auto ethernet already disabled"
else
  echo -ne '$\n?^auto eth0\ns/^auto eth0/#auto eth0/1\nwq\n' | ed -s /etc/network/interfaces > /dev/null
  egrep -q '^auto eth0' /etc/network/interfaces
  if [ "$?" != "0" ]
  then
    echo "Auto ethernet disabled"
  else
    echo "Failed to update /etc/network/interfaces"
  fi
fi
  


