I have a folder called 'sql' that contains .sql files. I want to write a script that searches for all .sql files, puts the filename into an array, and then kicks off each file.
ie:
#!/bin/bash
# Options
DBHOST=MySQL-hostname
DBNAME=MySQL-database
DBUSER=MySQL-username
DBPASS=MySQL-password
# Find .sql Files
???
# Create MySQL Tables
for i in "${TBNAME[@]}"; do
mysql -h "$DBHOST" -u "$DBUSER" -p"$DBPASS" "$DBNAME" < $TBNAME[$i]
done
How can I search for .sql files within a specified folder?