DBLIST=`mysql -u${DBUSER} -p${DBPASS} -h${DBHOST} -e 'show databases;' ` DBLIST=`echo "${DBLIST}" | egrep -v ^Database$ | egrep -v ^information_schema$ | egrep -v ^innodb$ | egrep -v ^mysql$ | egrep -v ^performance_schema$ | egrep -v ^tmp$` if [ ! -d /opt/backup ]; then mkdir /opt/backup fi ( IFS=$'\n'; for LINE in `echo "${DBLIST}"` do mysqldump -u${DBUSER} -p${DBPASS} -h${DBHOST} ${LINE} > /opt/backup/${LINE}.dump done )