set -e final_path=/var/www/noalyss sudo rm -rf $final_path for i in $(sudo "su -c 'psql -l | grep \"\\" | awk \'{print $1}\''") do sudo "su postgres -c \"dropdb $i\"" done sudo "su postgres -c 'dropuser noalyss'"