This is the first bash script I wrote, I used crontab to periodically backup and compress a mysqldb in a shared hosting environment #!/bin/sh user=testdbuser password=testdb dbname=testdb location=~/db_backups ts=$(date ‘+%Y%m%d-%H%M’) mysqldump -u$user -p$password –opt $dbname > $location/temp-$ts.sql cd $location tar -cvzf $dbname-db-$ts.tar.gz temp-$ts.sql rm -f temp-$ts.sql
