sudo /Applications/avast!.app/Contents/MacOS/install.sh uninstall
rm -rf ~/Library/Application\ Support/Avast
rm ~/Library/LaunchAgents/com.avast.*
sudo reboot

Be noted, that normally install.sh is executed with UID!=0, EUID=0 and thus it behaves different than when called with sudo. The root of the installation/uninstallation issue is that the autorization mechanism leaves opened file descriptors and bash crashes on attempt to close one of them.