I have a directory with a bunch of .sql files that mysql dumps of each database on my server.
.sql
e.g.
database1-2011-01-15.sql database2-2
One-liner to read in all .sql files and imports them:
for SQL in *.sql; do DB=${SQL/\.sql/}; echo importing $DB; mysql $DB < $SQL; done
The only trick is the bash substring replacement to strip out the .sql to get the database name.